PagesPrinted field of job_info_2 not reliable for

2019-06-11 13:53发布

问题:

PagesPrinted field of job_info_2 not reliable for hp printers on windows 7, value depends on print processor

I'm developping a print monitor, and for hp printer PagesPrinted is not reliable et has wrong values

回答1:

The print driver for your printer is apparently calling SetJob with incorrect page count values. There's probably nothing you can do about that. Therefore, the only way to get an accurate page count is to parse the print data stream and count the pages yourself. The printer in question uses PCL. Fortunately, there is an open source PCL viewer available from sourceforge, which you can use to parse the PCL. Although this solution is more complex than simply calling GetJob, it should work reliably for all PCL printers. Supporting Postscript printers can be done in a similar manner, and the parsing is much simpler since Postscript puts the page count directly in the data stream.