Chapter 16. Filters

Table of Contents
16.1. Filter Functions
16.2. Filter Exit Codes
16.3. Print Job Formats
16.4. OF Filter
16.5. lpr -p format
16.6. lpr binary (-l) format
16.7. Chaining Filters
16.8. Filter Command Line Options and Environment Variables
16.9. LPRng Supported Filters
16.10. lpf
16.11. ifhp Filter

This section gives an overview of how LPRng uses filter programs, and gives a detailed discussion of how the printcap options and filters interact.

16.1. Filter Functions

Print filters are one of the most powerful tools in BSD-style printer systems.

In general UNIX terms, a filter is a program that takes its input file(s), does something with it, and sends the result to its standard output. Most UNIX utilities are designed as filters. (But since you are a system manager, you should already know that :))

In the context of a BSD-style print spooler (and also LPRng), the term filter refers to a program that processes file while it is being transferred to a printer.

The filter is executed with STDIN reading from the file to be printed STDOUT to the printer device or a temporary file. STDERR (file handle 2) is redirected to the status file, and file handle3 to an accounting file or program.

A filter can be as simple as a LF to CR/LF translator, or it can incorporate a complete accounting system, automatic file type translations, or even redirect the job to another printing system.

The lpf filter supplied as part of the LPRng distribution is a a very simple CR to CR/LF conversion filter. The ifhp filter provides support for more complex PostScript, PCL, and text printers.