Filters are used to handle device dependencies and accounting functions.

The filters include the following:

Output filters
Used when accounting isn't needed or when all text data must be passed through a filter.

An output filter isn't suitable for accounting purposes because it's started only once, all text files are filtered through it, it doesn't pass owners'login names, and it doesn't identify the beginnings and ends of jobs.

Input filters
Started for each file printed; they do accounting if there's an af field in the printer's printcap entry. If there are fields for both input and output filters, the output filter is used only to print the banner page; it's then stopped to allow input filters to access the printer.
Other filters
Used to convert files from one form to another. For example:

The tf entry specifies /usr/lib/rvcat as the filter to use when printing troff output. This filter is needed to set the device into print mode for text and into plot mode for printing troff files and raster images. Note that the page length is set to 58 lines by the pl entry for 8.5″ by 11″ fanfold paper.

To enable accounting, add an af filter to the varian entry, like this:

Note: QNX Neutrino doesn't provide print filters; you have to either port them from another Unix-type OS or write your own. If you don't want to do this, you can use the spooling system, which provides print drivers for specific families of currently popular printers. See spooler in the Utilities Reference and "Printing with spooler," below).

The lpd daemon spawns the filters; their standard input is the data to be printed; their standard output is the printer. Standard error is attached to the lf file for logging errors (or you can use syslogd). A filter must return an exit code of 0 if there were no errors, 1 if the job should be reprinted, or 2 if the job should be thrown away.

When lprrm sends a SIGINT signal to the lpd process that controls the printing, lpd sends a SIGINT signal to all filters and their descendants. Filters that need to do cleanup operations, such as deleting temporary files, can trap this signal.

The arguments lpd passes to a filter depend on the filter type: