At best, itβs complicated. To do this correctly, you need to run the output (PCL / PS / XPS) using RIP (Raster Image Processor), which can transform the language into what the printer is really going to output and see what comes out. You can look at the file for duplex codes in the language used for printing, but you may run into problems because duplex can be turned on and off everywhere. In addition, various manufacturers can put this in a custom PJL at the beginning of the job, and not in the standard PCL or PS encoding in the data stream itself.
If accuracy is not a big problem, then you can analyze the data and come up with some numbers, but you will never be accurate, especially if the file is clearly not duplex or not, and the printer is set to. In this case, it will be duplex, and you will never know. To add to this, the user can print several files (4 pages on one sheet). If they do this through the app, he will report 1 page. If they do this in the printer driver, it can go through 4 pages and allow the printer to be idle, in which case you will report 4 pages, not 1. Another case is a user who needs 100 copies of a 1-page document. The browser can only send 1 page, because the printer will do the job of creating multiple copies.
There are many tools on the market for collecting this data. Accurate, as a rule, receive data from the device after printing the job. Most modern printers have the ability to track printed pages and users, etc.
Sorry, I do not have a better / happier answer for you. Good luck.
source share