Skip to content

Print Job Status

Asp.Net Hein

Asp.Net Hein

Asked Apr 30, 2015, 1:51 AM EDT1 answer
Share
LinkedInX
How to get Print Job Status in c# ?
 
Please help me in correct code.
 
Thanks a lot :-)

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Manoj Bhoir
    0
    Hi,

    You might be able to use WMI for this.

    SelectQuery query = new SelectQuery("Win32_PrintJob");

    using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
    using (ManagementObjectCollection printJobs = searcher.Get())
        foreach (ManagementObject printJob in printJobs)
        {
            // The format of the Win32_PrintJob.Name property is "PrinterName,JobNumber"
            string name = (string) printJob["Name"];
            string[] nameParts = name.Split(',');
            string printerName = nameParts[0];
            string jobNumber = nameParts[1];
            string document = (string) printJob["Document"];
            string jobStatus = (string) printJob["JobStatus"];
        }
    0