1

I poll printer queue on any change like JOB_CHANGE, and if I see that some job disappeared, I report to server that job has been printed or deleted, according to job last status.

Problem is that the printer Kyocera M3550 returns as the last status JOB_STATUS_PAUSED, but no JOB_STATUS_DELETED or JOB_STATUS_PRINTED.

These are the statutes I get in ascending order:

  • JOB_STATUS_SPOOLING
  • 0 (which doesn't match to any known status)
  • JOB_STATUS_PASUED

What does that mean? I can't relay on the JOB_STATUS_PASUED as my last status because it is possible that someone preformed this intentionally.

SyndicatorBBB
  • 1,757
  • 2
  • 26
  • 44
  • Could be the printer has its own print processor which is setting jobs to paused before deleting them. Can't you go by the fact that the job vanishes that it was deleted? – Carey Gregory Mar 21 '18 at 17:56
  • @CareyGregory This is good idea. The issue is that I need to know the exact document that was deleted and this information doesn't exist for the PRINTER_CHANGE_DELETE_JOB. – SyndicatorBBB Mar 22 '18 at 14:24
  • 1
    You can query almost anything about a print job with `GetJob` as long as you call it before the job is deleted. – Carey Gregory Mar 22 '18 at 17:51
  • Yes good idea. It helped me a lot ! Would you mind to provide an answer so I can select it as accepted? – SyndicatorBBB Mar 22 '18 at 22:07
  • Which driver were you using? I'd like to test it. Cheers. – Nick Westgate Mar 24 '18 at 22:36
  • I tested a couple of Kyocera drivers. They don't have custom PP and the statuses I saw are normal (ends with Deleted, Printed etc). I think the problem is the OP's code which "polls printer queue", not using FindFirst/NextPrinterChangeNotification or not using it correctly. – Nick Westgate Mar 26 '18 at 01:47
  • @NickWestgate Hi Nick, sorry for the delay. I will send you the driver later on today I don't remember the name. It is not right. I do use FindFirstPrinterChangeNotification and FindNextPrinterChangeNotification and I do use them correctly. I'm not sure how you tested it but it is not enough only to install a driver, you should also configure the printer to pause any job it receives. Make sure you do it first and then test it. – SyndicatorBBB Mar 26 '18 at 06:28
  • @NickWestgate As I promised, the driver name is Kyocera ECOSYS M3550idn KX. I remind you that it is also related to the printer configuration. Thank you for the help! – SyndicatorBBB Mar 26 '18 at 09:13
  • Like the ones [here](https://www.kyoceradocumentsolutions.eu/index/service/dlc.false.driver.ECOSYSM3550IDN._.EN.html)? I tried the V4 and KX ones today with no problem. When you say configure the printer to pause any job, do you mean the printer or driver or print queue? (Obviously I don't have the physical printer.) I have software that pauses the job. Is that enough? Since Carey has already answered, feel free to contact me via email etc. – Nick Westgate Mar 26 '18 at 11:39
  • @NickWestgate In my enviroment there is a print server and this evniorment is configurated (using software as you specified) to pause any new job. Then If I want to really print the document, I come to the printer, enter my password, select one of the pending documents and select print. No problem. You can also feel free to contact me via email if you need help to reproduce it. – SyndicatorBBB Mar 26 '18 at 12:02
  • Your network profile has no contact details (mine does) and googling your handle only finds Stack Exchange accounts (google me - I'm not the wrestler - follow my SE pic to get me on Twitter). – Nick Westgate Mar 26 '18 at 19:36

1 Answers1

1

It may be that the Kyocera printer has its own print processor which is setting print jobs to a paused state before deleting them. In that case, you can still detect the deletion by the fact that the job disappears. Obviously, you'll have to keep a list of ongoing print jobs in order to detect deletions in this manner.

When the print job first appears, you should call the GetJob function with the Level parameter set to 2 and pass a JOB_INFO_2 struct to be filled in. The JOB_INFO_2 struct will provide all the information about a print job that's available.

Carey Gregory
  • 6,836
  • 2
  • 26
  • 47
  • Just one last thing, you mean that I should use polling calling the GeJob function and keep following the jobs ? Because when a job is deleted I don't have information about it (even not JobId). – SyndicatorBBB Mar 23 '18 at 06:36
  • @SyndicatorBBB Well, you're going to need some way of detecting that the job disappeared. When you get notified the job was created, you could call GetJob to get the info you need, and then save that in a list to be used later if the job vanishes without a delete notification. – Carey Gregory Mar 23 '18 at 14:18
  • Okay, I guess I need to work with it a little bit more. I was afraid that after the job is deleted, I won't be able to get details on this job using GetJob because the job was already deleted. – SyndicatorBBB Mar 24 '18 at 07:48
  • 1
    @SyndicatorBBB You won't. Once the job is deleted it's gone and you can't query anything about it. You have to do that query up front and save the info you need. – Carey Gregory Mar 24 '18 at 14:54