System Administration Guide: Advanced Administration

How to Create a New Print Filter

  1. Log in as superuser, lp, or assume an equivalent role on the print server.

  2. Create a print filter program.

    For information on print filter programs, see Writing a Print Filter Program. By convention, filter programs for PostScript printers are located in the /usr/lib/lp/postscript directory. You should put programs you create under the /usr/lib/lp directory in a directory of your choosing.

  3. Create a print filter definition.

    For information on print filter definitions, see Creating a Print Filter Definition. You should save the printer filter definition in a text file. By convention, filter definitions are located in the /etc/lp/fd directory and are identified with the .fd suffix.

  4. Add the print filter to a print server.

    For instructions, see How to Add a Print Filter.

Examples—Creating a New Print Filter

The following example shows a print filter definition to convert N37 or Nlp to simple.


Input types: N37, Nlp, simple
Output types: simple
Command: /usr/bin/col
Options: MODES expand = -x
Options: INPUT simple = -p -f

In this example, the print filter program is named col. Once you add the new print filter to a print server, a user's print requests will be handled as follows:

The following example shows a print filter definition to convert from troff to PostScript.


Input types: troff
 
Output types: postscript
 
Printer types: PS
 
Filter type: slow
 
Command: /usr/lib/lp/postscript/dpost
 
Options: LENGTH * = -l*
 
Options: MODES port = -pp, MODES land = -pl
Options: MODES group \=\([1-9]\) = -n\l

In this example, the filter program is named dpost. It takes one input type, troff, produces a postscript output, and works with any printer of type PS (PostScript). Users need to give just the abbreviation port or land when they ask for the paper orientation to be in portrait mode or landscape mode. Because these options are not intrinsic to the LP print service, users must specify them using the lp -y command.

After you add the new print filter to a print server, print requests will be handled as follows: