LPFILTER(8) | Maintenance Commands and Procedures | LPFILTER(8) |
lpfilter - administer filters used with the LP print service
/usr/sbin/lpfilter -f filter-name
{- | -i | -l | -x | -F pathname}
The lpfilter command is used to add, change, delete, or list a filter used with the LP print service. These filters convert the content of a file to have a content type acceptable to a printer.
Arguments consist of the -ffilter-name option and exactly one of the arguments appearing within braces ({}) in the SYNOPSIS.
−
-f filter-name
-F pathname
-i
-l
-x
The filter named in the -f option is added to the filter table. If the filter already exists, its description is changed to reflect the new information in the input.
When − is specified, standard input supplies the filter description. When -F is specified, the file pathname supplies the filter description. One of these two options must be specified to add or change a filter.
When an existing filter is changed with the -F or − option, lines in the filter description that are not specified in the new information are not changed. When a new filter is added with this command, unspecified lines receive default values. See below.
Filters are used to convert the content of a request from its initial type into a type acceptable to a printer. For a given print request, the LP print service knows the following:
The printer type is intended to be a printer model, but some people specify it with a content type even though lpadmin -I is intended for this purpose.
The values specified by the lpadmin -T are treated as if they were specified by the -I option as well.
The system uses the above information to construct a list of one or more filters that converts the document's content type into a content type acceptable to the printer and consumes all lp arguments that invoke filters (-y and -P).
The contents of the file (specified by the -F option) and the input stream from standard input (specified by −) must consist of a series of lines, such that each line conforms to the syntax specified by one of the seven lines below. All lists are comma or space separated. Each item contains a description.
Input types: content-type-list Output types: content-type-list Printer types: printer-type-list Printers: printer-list Filter type: filter-type Command: shell-command Options: template-list
Input types
Output types
Printer types
Printers
Filter type
Command
Options
In general, each template is of the following form:
keyword pattern = replacement
The keyword names the characteristic that the template attempts to map into a filter-specific option; each valid keyword is listed in the table below.
A pattern is one of the following: a literal pattern of one of the forms listed in the table, a single asterisk (*), or a regular expression. If pattern matches the value of the characteristic, the template fits and is used to generate a filter-specific option. The replacement is what will be used as the option.
Regular expressions are the same as those found on the regexp(7) manual page. This includes 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.
The replacement can also contain a *; it too, is replaced with the entire pattern, just like the & of regexp(7).
The keywords are:
lp Option Characteristic keyword Possible patterns -T Content type INPUT content-type
(input) Not applicable Content type OUTPUT content-type
(output) not applicable Printer type TERM printer-type -d Printer name PRINTER printer-name -f, -o cpi= Character pitch CPI integer -f, -o lpi= Line pitch LPI integer -f, -o length= Page length LENGTH integer -f, -o width= Page width WIDTH integer -P Pages to print PAGES page-list -S Character set CHARSET character-set-name
Print wheel CHARSET print-wheel-name -f Form name FORM form-name -y Modes MODES mode -n Number of COPIES integer
copies
If the filter named is one originally delivered with the LP print service, the -i option restores the original filter description.
The -x option is used to delete the filter specified in filter-name from the LP filter table.
The -l option is used to list the description of the filter named in filter-name. If the command is successful, the following message is sent to standard output:
Input types: content-type-list Output types: content-type-list Printer types: printer-type-list Printers: printer-list Filter type: filter-type Command: shell-command Options: template-list
If the command fails, an error message is sent to standard error.
See largefile(7) for the description of the behavior of lpfilter when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
Example 1 Printing with the landscape option
For example, the template
MODES landscape = -l
shows that if a print request is submitted with the -y landscape option, the filter will be given the option -l.
Example 2 Selecting the printer type
As another example, the template
TERM * = -T *
shows that the filter will be given the option -T printer-type for whichever printer-type is associated with a print request using the filter.
Example 3 Using the keywords table
Consider the template
MODES prwidth\=\(.*\) = -w\1
Suppose a user gives the command
lp -y prwidth=10
From the table above, the LP print service determines that the -y option is handled by a MODES template. The MODES template here works because the pattern prwidth=) matches the prwidth=10 given by the user. The replacement -w1 causes the LP print service to generate the filter option -w10. If necessary, the LP print service will construct a filter pipeline by concatenating several filters to handle the user's file and all the print options. See sh(1) for a description of a pipeline. If the print service constructs a filter pipeline, the INPUT and OUTPUT values used for each filter in the pipeline are the types of input and output for that filter, not for the entire pipeline.
The following exit values are returned:
0
non-zero
lp(1), sh(1), attributes(7), largefile(7), regexp(7), lpadmin(8)
If the lp command specifies more than one document, the filtering chain is determined by the first document. Other documents may have a different format, but they will print correctly only if the filter chain is able to handle their format.
April 3, 1997 | OmniOS |