System Administration Guide: Printing

ProcedureHow to Create a New Print Filter

  1. On the print server, become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.

  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 print 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.


Example 10–7 Creating a New Print Filter

This example shows a print filter definition that is used 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 are handled as follows:

When a user types the following command:


$ 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

When a user types the following command:


$ 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


Example 10–8 Creating a New Print Filter by Converting One Input Type to Another Output Type

This example shows a print filter definition that is used to convert from troff to a PostScript file.


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. The filter program 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 either portrait mode or landscape mode. Because these options are not intrinsic to the LP print service, users must specify them by using the lp -y command.

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