System Administration Guide: Advanced Administration

Defining Print Filter Options With Templates

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

Characteristic

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

Special modes

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:

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


Note –

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.