Options specify how different types of information are converted into command-line arguments to the filter command. This information can include specifications from a user (with the print request), the printer definition, and the specifications implemented by any filters used to process the request.
There are 13 sources of information for defining print filter options, each of which is represented by a keyword. Each option is defined in a template. A template is a statement in a filter definition that defines an option to be passed to the filter command, based on the value of one of the characteristics of the filter.
The options specified in a filter definition can include none, all, or any subset of the 13 keywords. In addition, a single keyword can be defined more than once, if multiple definitions are required for a complete filter definition. The following table contains descriptions of the 13 keywords available for defining Options in a print filter definition.
Table 7–6 Print Filter Options Keywords
Keyword |
Possible Patterns |
Example |
|
---|---|---|---|
Content type (input) |
INPUT |
content-type |
troff |
Content type (output) |
OUTPUT |
content-type |
postscript, impress |
Printer type |
TERM |
printer-type |
att495 |
Printer name |
PRINTER |
printer-name |
lp1 |
Character pitch |
CPI |
scaled-decimal |
10 |
Line pitch |
LPI |
scaled-decimal |
6 |
Page length |
LENGTH |
scaled-decimal |
66 |
Page width |
WIDTH |
scaled-decimal |
80 |
Pages to print |
PAGES |
page-list |
1-5,13-20 |
Character set |
CHARSET |
character-set |
finnish |
Form name |
FORM |
form-name |
invoice2 |
Number of copies |
COPIES |
integer |
3 |
MODES |
mode |
landscape |
A print filter definition can include more than one template. Multiple templates are entered on a single line and separated with commas, or they are entered on separate lines, preceded by the Options: prefix.
The format of a template is as follows:
keywordpattern = replacement
The keyword identifies the type of option being registered for a particular characteristic of the filter.
The pattern is a specific option for the keyword.
The replacement is what happens when the keyword has the noted value.
For an example of how an option is defined for a particular filter, suppose you want to have the print service scheduler assign print requests to filters following this criteria:
If the type of OUTPUT to be produced by the filter is impress, then pass the -I option to the filter.
If the type of OUTPUT to be produced by the filter is postscript, then pass the -P option to the filter.
To specify these criteria, provide the following templates as options to the lpfilter command:
Options: OUTPUT impress=-I, OUTPUT postscript=-P |
If the Options line becomes too long, put each template on a separate line, as follows:
Options: OUTPUT impress=-I Options: OUTPUT postscript=-P |
In both templates, the keyword is defined as OUTPUT. In the first template, the pattern is impress and the value of the replacement is --I. In the second template, the value of pattern is postscript and the value of replacement is -P.
To find out which values to supply for each type of template (that is, for the pattern and replacement arguments for each keyword), consider the following:
The values for the INPUT templates come from the file content type that needs to be converted by the filter.
The values for the OUTPUT templates come from the output type that has to be produced by the filter.
The value for the TERM template is the printer type.
The value for the PRINTER template is the name of the printer that will print the final output.
The values for the CPI, LPI, LENGTH, and WIDTH templates come from the user's print request, the form being used, or the default values for the printer.
The value for the PAGES template is a list of pages that should be printed. Typically, it is a list of page ranges separated by commas. Each page range consists of a pair of numbers separated by a dash, or a single number. (For example, 1–5,6,8,10 indicates pages 1 through 5, plus pages 6, 8, and 10.) However, whatever value was given in the -P option to a print request is passed unchanged.
The value for the CHARSET template is the name of the character set to be used.
The value for the FORM template is the name of the form requested by the lp -f command (the command used to submit a print request).
The value of the COPIES template is the number of copies of the file to print. If the filter uses this template, the LP print service will reduce to one the number of copies of the filtered file it prints, since this “single copy” includes the multiple copies produced by the filter.
The value of the MODES template comes from the lp -y command. Because a user can specify several -y options, there might be several values for the MODES template. The values will be applied in the left-to-right order given by the user.
The replacement part of a template shows how the value of a template should be given to the filter program. It is typically a literal option, sometimes with the placeholder asterisk (*) included to show where the value goes. The pattern and replacement also can use the regular expression syntax of the ed command for more complex conversion of user input options into filter options. All regular expression syntax of ed is supported, including the \( ... \) and \n constructions, which can be used to extract portions of the pattern for copying into the replacement, and the &, which can be used to copy the entire pattern into the replacement. For more information, see ed(1).
If a comma or an equal sign (=) is included in a pattern or a replacement, precede it with a backslash (\). A backslash in front of any of these characters is removed when the pattern or replacement is used.