System Administration Guide

How to Create a New Print Filter

  1. Log in as superuser or lp on the print server.

  2. Create a print filter program.

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

  3. Create a print filter definition.

    See "Creating a Print Filter Definition" for information on print filter definitions. 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:


$ lp -y expand report.doc

The print filter program is run with the following arguments to convert the file:


/usr/bin/col -x -p -f

$ lp -T N37 -y expand report.doc

The print filter program is run with the following arguments to convert the file:


/usr/bin/col -x

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 -y option to the lp command.

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


$ lp -T troff -o length=60 -y land -d luna ch1.doc

The print filter program dpost is run with the following arguments to convert the file:


/usr/lib/lp/postscript/dpost -l60 -pl luna ch1.doc

$ lp -T troff -y group=4 -d luna ch1.doc

The print filter program dpost is run with the following arguments to convert the file:


/usr/lib/lp/postscript/dpost -n4