Get an absolute path to the printing document

Andrew andrew.kanner at gmail.com
Wed Oct 19 02:58:25 PDT 2011


In brief I develop some security system in which each document (as an object of file system) have some mandatory label, and I need to print this label in my stamp on the paper document. So I developed a cups-filter, which change the document (postscript) before printing but I can`t understand how can I get an absolute path to the document (I need it to get right mandatory label on the document), printing from a random application (all I could see in cups - is only a filename and I think this object is already in the /var/spool/, it isn`t the real target document).
For example I used Ubuntu and tried to understand how works printing subsystem in it. I used strace utility and found out that OpenOffice (LibreOffice) don`t use such tools like lpr, etc (no exec commands at all). Gedit uses some .so libraries from /usr/lib/gtk-2.0/2.10.0/printbackends/ like "libprintbackend-cups.so", "libprintbackend-file.so", "libprintbackend-lpr.so", etc. I can`t complete understand how the file moves to the /var/spool/ (it makes cups or application?).
Is there any universal method to get an absolute path to a printing document from any application (in OpenOffice I wrote a macros which can get a path to the opened document, but this method is not suitable - I need to get this path from a random application which can initiate print job)?




More information about the cups-devel mailing list