Log in as superuser, lp, or assume an equivalent role on the print server.
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.
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.
Add the print filter to a print server.
For instructions, see How to Add a 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 |
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:
When a user types the following command to submit a troff file type for printing on a PostScript printer (type PS), with requests for landscape orientation and a page length of 60 lines:
$ 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 |
When a user enters the following command:
$ 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 |