How to send application unique identifier?

Mar 2, 2015 at 3:45 PM
Hello,

I want to send application specific unique identifier whiling sending print command. Get the same unique identifier in JobDeleted event for reconcilation purpose. How we can achieve this ?
Coordinator
Mar 2, 2015 at 11:14 PM
I'm not sure I understand. You want to supply an identifier and then be able to read that identifier back when the job is deleted from the spooler?

I guess the best thing would be to use the SetJob API to alter the DEVICEMODE attached to the job and to add your identifier in the dmExtra part (increasing the dmExtra amount accordingly) but this might be more than you need?
Mar 3, 2015 at 6:23 AM
Thanks Merrion,

I’m writing a multithreaded windows service in c# which accepts multiple print requests/ files and send those to different printers.

I’m using following code to send Print command.

using (PrintDocument objPrintDoc = new PrintDocument())
{
objPrintDoc.DocumentName = fileName;
   objPrintDoc.PrinterSettings = printerSettings;   // Printer settings 

if (objPrintDoc.PrinterSettings.IsValid)
      objPrintDoc.Print();      
}

In JobDeleted event getting only Document name .
private void PrinterMonitorComponent_JobDeleted(object sender, PrintJobEventArgs e)
{
            string str = "";
            str += "Printer Name: " + e.PrintJob.PrinterName;
            str += " User Name: " + e.PrintJob.UserName;
            str += " Document Name: " + e.PrintJob.Document;
            str += " Total Pages: " + e.PrintJob.TotalPages;
            str += " Status: " + e.PrintJob.StatusDescription;
            str += " Pages Printed: " + e.PrintJob.PagesPrinted;
            str += " JobID: " + e.PrintJob.JobId;
}

Apart from Document name is there anything which can be passed while sending the Print command and get the passed value in JobDeleted event ?
Coordinator
Mar 3, 2015 at 2:13 PM