Need information on Printing and Printer Queue

Nov 2 2009 3:00 PM
Hello,

I am trying to develop a Print Management System. The basic idea behind this application is that, there are list of documents that needs to be printed at a specified printer and we need to keep a watch on how the printing is being carried out to get the status of the job.

Till now I was able to get the following things done,
1) Send document for printing to a specified printer
2) Add EventWatcher's to the print queue, that will keep a watch on a) what new jobs are being added b) jobs being modified c) jobs deleted

I submit a job for printing to the printer queue by making use of the following

Process objProcess = new Process();
try
{
AddPrinterConnection(@"HP Deskjet D1300 Series");
SetDefaultPrinter(@"HP Deskjet D1300 series");

objProcess.StartInfo.FileName = "D:\\Remote Printing Management\\1.txt";
objProcess.StartInfo.Verb = "Print";
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
objProcess.StartInfo.UseShellExecute = true;
objProcess.Start();

}
catch (Exception ex)
{
//Exception caught
}
finally
{
objProcess.Close();
}

And in the eventwatcher's I am able to get the appropriate events.

But the problem I am facing now is that, When i submit the job for printing as shown above, I need to find some way to get the jobid of the printjob so that I can identify the job properly and update some status in my database. Can somebody throw some light on this? Any help would be greatly appreciated.

Thanks in advance!

Answers (1)