2

We are trying to assemble a free software stack to get detailed print job accounting information, something similar to what Papercut Printlogger does, for raw printing queues. We have been testing Apple Common Unix printing system (Cups) in Debian GNU is not Unix (GNU)/Linux with Pykota Tee for Cups (Tea4Cups).

In Cups, Hewlett-Packard (HP) Printer Control Language (PCL) printing job files include an HP Printer Job Language (PJL) header with job information such as number of copies, duplex or simplex, colour or black & white &c. HP even defines both PCL and PJL in the same document.

In Microsoft (MS) Windows, each print job is queued as two files: an Spool (SPL) one which has the print file itself, in whichever language: Adobe Postscript (PS), HP PCL, Epson Standard Code for Printers (Esc/P), whatever; and a Shadow (SHD) file with the PJL information.

As far as we have been able to determine, Postscript print jobs in Cups do not include nothing equivalent to PJL or SHD, neither in the PS file itself nor in a separate file.

So, is it possible to get such print job information in Cups?

1
  • ¿Is any information missing, or should this question be in any other Stack exchange site? – Leandro May 14 '18 at 13:43
3

CUPS also (temporarily) stores print jobs in (at least) two different files. For a given job ID of 123456 composed of a single-document job, these would be:

/var/spool/cups/d123456-001
/var/spool/cups/c123456

For a given job ID of 123457 composed of multiple documents, these would be:

/var/spool/cups/d123457-001
/var/spool/cups/d123457-002
/var/spool/cups/d123457-003
/var/spool/cups/c123457

Here, the d.... file represents the actual data file containing the job's document exactly as it was submitted by the CUPS client (and before the CUPS filtering chain for converting the job file to the target printer's desired format).

The c.... file represents the job control file which holds all the relevant meta information about the job (most importantly perhaps: the printing options the user wanted, like "duplex, stapled, with paper from tray 3").

The problem for me, earlier today was how to dissect the c.... file and extract all the gory details from it, because it is not in clear text. Running strings against it, revealed some, but not all.

I started to search almost all of StackExchange for an answer... which is when I noticed this related question here. Then I search-engined for more info, but still no useful result.

Finally, I even asked a question on StackOverflow about this myself:

Then I continued with searching the CUPS source code on Github for any clues. After a few hours, I found the answer:

  • Use a utility which you can build from CUPS sources (but which does not build as a default Makefile target, and hence does not ship on ANY Linux distro I know of nor on macOS): it is named testipp.

See my own answer to above linked StackOverflow question here:

Screenshot of my StackOverflow answer

Unfortunatly, these useful utils are not packaged by any distro! If you know a distro packager person, please point them to this issue and ask him/her to have a look!

3
  • Thanks a lot! Too bad my bounty on this question expired already, you certainly earned it. – Leandro Dec 11 '18 at 14:46
  • @lfd: I didn't see there was any bounty on this even... – Kurt Pfeifle Dec 11 '18 at 19:27
  • There was, but it expired already, sorry. – Leandro Dec 11 '18 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.