fritz.potsdam.edu
CUPS Applications and Tools

CUPS Applications and Tools


The CUPS filtering and backend architecture has allowed me to write a lot of custom code to solve various problems. In particular, I have spent a lot of time working on job accounting for our printing system (hence the various accounting schemes.) I have also developed some other specialized solutions.



Accounting Backend (SNMP) -- accsnmp

This latest and greatest accounting backend is a Perl script backend wrapper that queries the printer's page count over SNMP, before and after the job, takes the delta and stores it in a text file named for the user. It ensures that no other jobs print during this window because it does not release until the printer indicates it is done printing. It supports job and user blacklisting.

Example URI -- accsnmp://lpd://123.123.123.123

This backend was developed mainly to allow us free selection of print drivers with which to render the job. Since it does not parse the job, any driver and printer language is supported. We have found that PCL drivers seem to render PDFs better. Aside from that, it should cut down on accounting problems due to postscript parsing errors.

README contains full installation and configuration details.



Mailbox ImageRUNNER -- mboxir

This is a Perl backend wrapper designed specifically to filter jobs into a specified mailbox of a Canon imageRUNNER (iR2270 tested).

Example URI -- mboxir://0/lpd://123.123.123.123

The second parameter is the mailbox into which the printjob will be stuffed. This backend will only work with postscript. It removes any existing PJL and adds the necessary PJL header, commands, and footer, for mailbox insertion.



PDF Printer -- pdf

I wrote a Perl PDF backend that uses ghostscript ps2pdf to take your postscript job and convert it to a pdf. This is fairly straightforward. I saw a shell script somewhere that did something similar. It requires a ghostscript install.

Example URI -- pdf://path/to/dir



A2PDF Backend -- a2pdf

This is a very special-purpose backend written to allow some legacy text-only jobs arriving over legacy LPD to use the formatting options allowed by the very mature a2ps. Formatting parameters are passed through the job title (and in our case, a fileshare parameter into which a pdf will be written). We have an ancient VMS system with a billion old DCL jobs that printed text to printers using PCL formatting strings. We needed the same formatting capability to move from the old line printers to a PDF environment.

This backend is designed to be used on a raw queue. In the case of a non-raw queue, the job will be filtered by CUPS into something other than text by the time it gets to the backend, and therefore the formatting options will not be applied because the backend will not call a2ps. However, if it sees postscript, it will still convert the job to PDF using ps2pdf.



LPD Accounting Backend -- lpdacc (no longer maintained 12/2005)

This is a Perl backend wrapper, which functions almost identically to psacc, but as its name suggests, wraps around the lpd backend. Each job is not accounted until the backend returns that the printer received the job.

Example URI -- lpdacc://123.123.123.123

This backend has been developed to completely replace psacc everywhere in our operation. Though psacc functions flawlessly as a CUPS filter, there are some limitations from which the CUPS filter design suffers with regard to accounting that were fatal in our environment:

  • If a queue is paused and restarted, jobs are sent through the filter chain again, and again each time. This means charged for the job each time.
  • On raw queues, jobs do not hit the filter chain and are therefore not accounted. We have had some very bad trouble finding CUPS .ppds/drivers that worked with all flavors of Windows (using cupsaddsmb). Jobs that hit the filter chain produced inconsistent outpout. We ended up switching to an all raw queue model and the Windows Add Printer Wizard.

By the simple virtue of being a backend, these points are moot. Plus, this backend works on raw queues and filtered ones alike.



PAP Backend -- pap (no longer maintained 12/2005)

The Pap backend will print to an Appletalk printer. Useful for old Appletalk-only junkers you still have kicking around. This was mostly written by one of my colleagues, and slightly revised. It requires a Netatalk install.

Example URI -- pap://"Printer Name"@"Some Zone"



Postscript Accounting Filter -- psacc (no longer maintained 12/2005)

An accounting filter inserted into the CUPS filter chain which searches for username, pages, and copies. A necessary replacement for the default CUPS pstops filter in our environment because we have many "root" jobs coming in over Netatalk for which the real username was embedded in the postscript. Plus, we accomplish accounting by saving each user's semester pagecount in a text file named after their username to which this filter adds each jobs pagecount. Finally, user blacklisting support.