大网数据广告活动
服务器运维问答

Where does Cups keep print job information?

· 52CE 我爱测

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 syste…

问题原文

原帖链接 · Leandro · CC BY-SA 4.0

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?

已采纳解答

原帖链接 · Kurt Pfeifle · CC BY-SA 4.0

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:

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!

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-05-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。