dpost filter example
The filter program /usr/lib/lp/postscript/dpost takes one input type, troff, produces an output type called postscript and works with any printer of type PS (for PostScript).
You have decided that your users need to provide just the abbreviations port and land when they ask for the paper orientation to be portrait mode and landscape mode, respectively. Because these options are not intrinsic to the print service, users must specify them using the -y option to the lp command.
The filter definition would look like this:
Input types: troff
Output types: postscript
Printer types: PS
Filter type: slow
Command: /usr/lib/lp/postscript/dpost
Options: LENGTH * = -l*
Options: MODES portrait = -op, MODES land = -ol
A user submitting a file of type troff for printing on a PostScript printer (type PS), with requests for landscape orientation and a page length of 60 lines, would enter the following command:
lp -T troff -o length=60 -y land -d any
This filter would be invoked by the print service to convert the file as follows:
/usr/lib/lp/postscript/dpost -l60 -ol -pl