How to get Print Job Status in c# ?
Please help me in correct code.
Thanks a lot :-)
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manoj BhoirPosted May 1, 2015, 12:54 AM
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"];
}