Note: This is a System V Print Subsystem command.
Administers filters used with the LP print service.
The lpfilter command is used to add, change, delete, and list a filter used with the LP print service. These filters are used to convert the content type of a file to a content type acceptable to a printer.
If you enter lpfilter -?, the system displays the command usage message and returns 0.
Item | Description |
---|---|
- (hyphen) | Adds or changes a filter as specified from standard input. |
-f FilterName | Specifies the name of the filter to be added, changed, deleted, or listed. |
-F PathName | Add or changes a filter as specified by the contents of the file pathname. |
-i | Resets an original filter to its original settings. |
-l | Lists a filter description. |
-x | Deletes a filter. |
The parameter all can be used instead of a FilterName with any of these flags. When all is specified with the -F or - flag, the requested change is made to all filters. Using all with the -i flag has the effect of restoring to their original settings all filters for which predefined settings were initially available. Using the all parameter with the -x flag results in all filters being deleted, and using it with the -l flag produces a list of all filters.
Adding or changing a filter
The filter named in the -f flag is added to the filter table. If the filter already exists, its description is changed to reflect the new information in the input.
The filter description is taken from the PathName if the -F flag is given or from the standard input if the - flag is specified. One of the two must be given to define or change a filter. If the filter named is one originally delivered with the LPprint service, the -i flag restores the original filter description.
When an existing filter is changed with the -F flag or the - flag, items that are not specified in the new information are left as they were. When a new filter is added with this command, unspecified items are given default values.
Filters are used to convert the content of a request into a data stream acceptable to a printer. For a given print request, the LP print service knows the following:
It uses this information to find a filter or a pipeline of filters that converts the content into a type acceptable to the printer.
A list of items that provide input to this command and a description of each item follows. All lists are comma or space separated.
Item | Description |
---|---|
Input types | Gives the types of content that can be accepted by the filter. (The default is any.) |
Output types | Gives the types of content that the filter can produce from any of the input content types. (The default is any.) |
Printer types | Gives the type of printers for which the filter can be used. The LP print service restricts the use of the filter to these types of printers. (The default is any.) |
Printers | Gives the names of the printers for which the filter can be used. The LP print service restricts the use of the filter to just the printers named. (The default is any.) |
Filter type | Marks the filter as a slow filter or a fast filter. Slow filters are generally those that take a long time to convert their input. They are run unconnected to a printer to keep the printers from being tied up while the filter is running. If a listed printer is on a remote system, the filter type for it must have the value slow. Fast filters are generally those that convert their input quickly or those that must be connected to the printer when run. These are given to the interface program IP to run connected to the physical printer. |
Command | Specifies the program to run to invoke the filter. The full
program pathname as well as fixed flags must be included in the shell-command;
additional flags are constructed, based on the characteristics of
each print request and on the "flags'' field. A command must be given
for each filter. The command must accept a data stream as standard input and produce the converted data stream on its standard output. This allows filter pipelines to be constructed to convert data not handled by a single filter. |
Flags | Specifies the comma-separated list of templates used by the
LP print service to construct flags to the filter from the characteristics
of each print request listed in the table later. 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 flag; 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 flag. The replacement is what is used as the flag. |
Regular expressions are the same as those found in the ed or vi commands. 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 ed command.
lp flag | Properties |
---|---|
-T |
|
N/A |
|
N/A |
|
-d |
|
-f, -o cpi= |
|
-f, -o lpi= |
|
-f, -o length= |
|
-f, -o width= |
|
-P |
|
-S |
|
-f |
|
-y |
|
-n |
|
For example, the template MODES landscape = -l shows that if a print request is submitted with the -y landscape flag, the filter is given the flag -l. As another example, the template TERM * = -T * shows that the filter is given the flag -T printer-type for whichever printer-type is associated with a print request using the filter.
As a last example, 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 flag 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 -w\1 causes the LP print service to generate the filter flag -w10.
If necessary, the LP print service constructs a filter pipeline by concatenating several filters to handle the user's file and all the print flags. If the print service constructs a filter pipeline, the INPUT and OUTPUT values used for each filter in the pipeline are the types of the input and output for that filter, not for the entire pipeline.
Deleting a filter
The -x flag is used to delete the filter specified in FilterName from the LP filter table.
Listing a filter description
The -l flag is used to list the description of the filter named in FilterName. 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
flags: template-list
If the command fails, an error message is sent to standard error.