First of all, I work on windows XP, excel 2003, VS 2010, .NET 4.0 and I gather information of every print using PrintQueueWatch .Net library. What I have seen so far is, when I print an excel active sheet with more than one copies jobdeleted event fires more than one. What I expected was that because I print one document one jobID would be made for the whole session but job deleted is fired for every single copy. So If I print one page with 3 copies I get at least 3 jobIDs. The real problem is now. When I print one page with 3 for example copies after the first copy the other 2 copies get twice in jobdeleted so I get exactly 3 unique PrintJob.jobID but 5 times(18, 19, 19, 20, 20). My question is why job deleted is fired more than once in a print session and especially why in every copy.
1 Answers
The Microsoft Office applications actually do some behind the scenes stuff to take over from the standard printer libraries when handling copies. This allows them to, for example, offer page collation and copy collation options that the printer driver themselves do not offer.
They do this by (in many circumstances) creating a separate print job for each copy and these then process in the usual fashion with their own print job id, using the JOB_INFO_3 structure.
When a job is deleted but it still has linked jobs not yet deleted it raises the event but actually does not delete. Only when the whole chain is deleted does the actual delete function complete.
Unfortunately I never coded any handling of JOB_INFO_3 but should you wish so to do the code is on GitHub.

- 558
- 4
- 8
-
thank you very much for your answer! As soon as I work with your advice I will write here the results! – vicangel May 18 '18 at 09:06
-
thank you for your great answer and code! I implemented Job_Info_3 in a seperate class but unfortunately I did not get a value on nextjobId so it was like every copy was a seperate and independed JobId. PrinterSettings class and PrintQueue class did not return the expected number of copies, so In my solution I use the submitted time of printjob to filter the jobs of the same print. – vicangel May 28 '18 at 12:35