JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
System Administration Guide: Printing     Oracle Solaris 10 8/11 Information Library
search filter icon
search icon

Document Information

About This Book

1.  Introduction to Printing in the Oracle Solaris Operating System

2.  Planning for Printing (Tasks)

3.  Setting Up Network Printing Services (Tasks)

4.  Setting Up and Administering Printers by Using Oracle Solaris Print Manager (Tasks)

5.  Setting Up Printers by Using LP Print Commands (Tasks)

6.  Administering Printers by Using LP Print Commands (Tasks)

7.  Customizing LP Printing Services and Printers (Tasks)

8.  Administering the LP Print Scheduler and Managing Print Requests (Tasks)

9.  Administering Printers on a Network (Tasks)

10.  Administering Character Sets, Filters, Forms, and Fonts (Tasks)

Administering Character Sets (Task Map)

Administering Character Sets

Selectable Character Sets

Hardware Character Sets

Tracking Print Wheels

Alerts for Mounting Print Wheels or Font Cartridges

How to Define a Print Wheel or Font Cartridge

How to Unmount and Mount a Print Wheel or Font Cartridge

How to Set an Alert to Mount a Print Wheel or Font Cartridge

How to Set Up an Alias for a Selectable Character Set

Administering Print Filters (Task Map)

Creating a New Print Filter

Writing a Print Filter Program

Types of Filters

Converting Files

Handling Special Printing Modes

Detecting Printer Faults

Requirements for a Print Filter Program

Creating a Print Filter Definition

lpfilter Command

lpfilter Input Types Argument

lpfilter Output Types Argument

lpfilter Printer Types Argument

lpfilter Printers Argument

lpfilter Filter Type Argument

lpfilter Options Argument

Defining Print Filter Options With Templates

How to Create a New Print Filter

Administering Print Filters

Creating Print Filters

Adding, Changing, Deleting, and Restoring Print Filters

How to Add a Print Filter

How to Delete a Print Filter

How to View Information About a Print Filter

Administering Forms (Task Map)

Creating a New Printer Form

How to Create a New Printer Form Definition

Administering Forms

Adding, Changing, or Deleting Forms

How to Add a Form

How to Delete a Form

Mounting Forms

How to Unmount and Mount a Form

Tracking Forms

Defining Alerts for Mounting Forms

How to Set an Alert to Mount a Form

Checking Forms

How to View Information About a Form

How to View the Current Status of a Form

Limiting Access to Forms

How to Limit User Access to a Form

How to Limit Printer Access to a Form

Administering Fonts (Task Map)

Administering Fonts

Managing Printer-Resident Fonts

Downloading Host-Resident Fonts

Installing and Maintaining Host-Resident Fonts

How to Install Downloaded PostScript Fonts

How to Install Host-Resident PostScript Fonts

11.  Administering Printers by Using the PPD File Management Utility (Tasks)

12.  Printing in the Oracle Solaris Operating System (Reference)

13.  Troubleshooting Printing Problems in the Oracle Solaris OS (Tasks)

A.  Using the Internet Printing Protocol



Creating a New Print Filter

A filter is used by the LP print service each time it has to print a type of file that the printer cannot interpret. Creating a new print filter is not easy, and it usually requires extensive experimentation.

The process of defining a new print filter consists of two steps:

A print filter can be as simple or as complex as needed. Filters contain input types, output types, and complex options that provide a language to process command-line arguments within the filter.

If you have nonPostScript printers, you have to create and add print filters as required. First, you need to understand what print filters are and the requirements that must be met by a filter program.

Writing a Print Filter Program

The LP print service provides filter programs in the /usr/lib/lp/postscript directory. These filters cover most PostScript printing situations, where the destination printer requires the data to be in PostScript format. A print filter program must be a binary executable file.

Types of Filters

There are two types of print filters: fast filters and slow filters.

Fast filters do not require much processing time to prepare a file for printing. They must have access to the printer when they run. To be capable of detecting printer faults, a print filter must be a fast filter. Any filter that uses the PRINTER keyword as a filter option must be installed as a fast filter.

Slow filters require a great deal of processing time to prepare a file for printing. They do not require access to the printer when they run. Slow filters are run in the background so they do not tie up the printer, allowing other files that do not need slow filtering to be printed.

Converting Files

The LP print service uses print filters to convert files from one content type to another content type. You can specify the accepted file content types for each printer. The user specifies the file content type when submitting a print request. Then, the LP print service finds a printer that can print files of that content type. Because many applications can generate files for various printers, this method is often sufficient. However, some applications can generate files that cannot be printed on any available printers.

Each time the LP print service receives a request to print a type of file that is in a format that cannot be accepted directly by a printer, the LP print service tries to match the content type of the print request with the content type of the available (or specified) printer. If there is a match, the file can be sent directly to the printer without filtering. If no match is found, or if the content type specifies that a filter be used, the LP print service tries to match the content type of the file with the input content type of available filters. In addition, the LP print service tries to match the output type of the filter with the content type of the printer. When an appropriate filter is found, the print request is passed through the filter.

Handling Special Printing Modes

A print filter handles special printing modes and requests to print specific pages. A special printing mode is needed to print any characteristics of print requests that require a customized filter.

Filters handle the following characteristics:

The LP print service provides default settings for these characteristics. However, a print filter can handle some characteristics more efficiently. For example, some printers can handle multiple copies more efficiently than the LP print service. So, in this case, you can provide a filter for multiple-copy page control.

Detecting Printer Faults

Each printer has its own way of detecting printer faults and transmitting fault signals to the LP print service. The LP print service only checks for hang-ups (loss of carrier) and excessive delays in printing.

Some printers provide good fault coverage and can send a message that describes the reason for a fault. Other printers indicate a fault by using signals other than the signals for loss of carrier signal or shut off of data flow. A filter is required to interpret this additional printer fault information.

A filter can also put a print request on hold, wait for a printer fault to clear, and then resume printing. With this capability, the print request that was interrupted does not need to be reprinted in its entirety. Only a filter that knows the control sequences used by a printer can determine where to break a file into pages. Consequently, only such a filter can find the place in the file where printing should start after a fault is cleared.

When a print filter generates messages, those messages are handled by the LP print service. If alerts are enabled, the LP print service sends alerts to the system administrator. For further information, see Setting Up Printer Fault Alerts by Using LP Print Commands.

Requirements for a Print Filter Program

A print filter can be simple or complex, but it has to meet the following requirements:

If you want the filter to detect printer faults, it should also meet the following requirements:

Creating a Print Filter Definition

A print filter definition tells the LP print service about the filter, what print filter program to run, what kind of conversion the print filter does, and so on. A set of filter descriptor files are provided in the /etc/lp/fd directory. These files describe the characteristics of the filters (for example, fast filter or slow filter), and point to the filter programs (for example, /usr/lib/lp/postscript/postdaisy).

When defining a new print filter, you must create a print filter definition.

A print filter definition contains the following information used by the LP print service:

You can type the characteristics as direct input to the lpfilter command. You also can create a file that specifies the filter's characteristics, and use the file name as input to the lpfilter command arguments. Such a file is called a filter descriptor file and should be located in the /etc/lp/fd directory. These files are not the filters themselves. Rather, these files point to the filters.

Whether you store the information in a file, or type the information directly on the command line, use the following format:

Command: command-pathname [options]
Input types: input-type-list
Output types: output-type-list
Printer types: printer-type-list
Printers: printer-list
Filter type: fast or slow
Options: template-list

Note - If you provide more than one definition (that is, more than one line) for any filter characteristic other than Options, only the second definition is used by the print service.

The information can be arranged in any order, and not all the information is required. When you do not specify values, the values shown in the following table are assigned by default. These values are not very useful, which is why you should specify values.

Table 10-3 Default Values for lpfilter Command

Default Value
Input types
Output type
Printer types
Filter type

lpfilter Command

Use the full path of the filter program. If there are any fixed options that the program always needs, include them here.

lpfilter Input Types Argument

Input types is a list of file content types that the print filter can process. The LP print service does limit the number of input types, but most filters can accept only one input type. Several file types can be similar enough, such that the filter can deal with them. You can use whatever names you prefer, with a maximum of 14 alphanumeric characters and dashes. Do not use underscores as part of the input type name.

The LP print service uses these names to match a filter to a file type, so follow a consistent naming convention. For example, if more than one filter can accept the same input type, use the same name for that input type when you specify it for each filter. Inform your users of these names so that they know how to identify the file type when submitting a file for printing.

lpfilter Output Types Argument

Output types is list of file types that the filter can produce as output. For each input type, the filter produces a single output type. The output type can vary, however, from job to job. The name of the output type is restricted to 14 alphanumeric characters and dashes.

The output type names should either match the types of available (local or remote) printers, or match the input types handled by other filters. The LP print service groups filters in a shell pipeline if it finds that several passes by different filters are needed to convert a file. You will unlikely need this level of sophistication, but the LP print service allows it. Try to find a set of filters that takes as input types all the different files the users might want printed, and that converts those files directly into file types the printer can handle.

lpfilter Printer Types Argument

Printer types is a list of the types of printers into which the print filter can convert files. For most printers and filters, you can leave this part of the filter definition blank, because this list is identical to the list of output types. However, this list can be different. For example, you could have a printer with a single printer type for purposes of initialization. However, that printer can recognize several different file content types. Essentially, this printer has an internal filter that converts the various file types into a filter type that it can handle. Thus, a filter might produce one of several output types that match the file types that the printer can handle. The print filter should be marked as working with that printer type.

As another example, you might have two different models of printers that are listed as accepting the same file types. Due to slight differences in manufacture, however, one printer deviates in the results it produces. You label the printers as being of different printer types, say A and B, where B is the printer that deviates. You create a filter that adjusts files to account for the deviation produced by printers of type B. Because this filter is needed only for those printer types, you would list this filter as working only on type B printers.

lpfilter Printers Argument

A print filter normally can work with all printers that accept its output, so you can usually skip this part of the filter definition.

You might, however, have some printers that are inappropriate for the output that the filter produces. For example, you might want to dedicate one printer for fast turnaround, only sending files that require no filtering to that printer. Other printers of identical type can be used for files that need extensive filtering before they can be printed.

lpfilter Filter Type Argument

The LP print service recognizes fast filters and slow filters, as described in Types of Filters.

Slow filters that are invoked by printing modes, by using the lp -y command, must be run on the system from which the print request originated. The LP print service cannot pass values for modes to print servers. It can, however, match a file content type (specified after the -T option of the lp command) to a content type on a print server. Therefore, if you want to activate special modes on a print server, you must specify content types that permit the LP print service to match input types and output types.

lpfilter Options Argument

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 that are used to process the request.

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 filter characteristics.

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 10-4 Keywords for Print Filter Options

Option Characteristic
Content type (input)
Content type (output)
postscript, impress
Printer type
Printer name
Character pitch
Line pitch
Page length
Page width
Pages to print
Character set
Form name
Number of copies
Special modes

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 determine 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 option shows how the value of a template should be given to the filter program. This part typically a literal option, sometimes with the placeholder asterisk (*) included to show where the value goes. The pattern and replacement options 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. These constructions can be used to extract portions of the pattern option for copying into the replacement option, and the & option, which can be used to copy the entire pattern option into the replacement option. For more information, see the ed(1) man page.

Note - If a comma or an equal sign (=) is included in a pattern or a replacement option, precede it with a backslash (\). A backslash in front of any of these characters is removed when the pattern or replacement option is used.

How to Create a New Print Filter

  1. On the print server, become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.

  2. Create a print filter program.

    For information on print filter programs, see Writing a Print Filter Program. By convention, filter programs for PostScript printers are located in the /usr/lib/lp/postscript directory. You should put programs you create under the /usr/lib/lp directory in a directory of your choosing.

  3. Create a print filter definition.

    For information on print filter definitions, see Creating a Print Filter Definition. You should save the print filter definition in a text file. By convention, filter definitions are located in the /etc/lp/fd directory and are identified with the .fd suffix.

  4. Add the print filter to a print server.

    For instructions, see How to Add a Print Filter.

Example 10-7 Creating a New Print Filter

This example shows a print filter definition that is used to convert N37 or Nlp to simple.

Input types: N37, Nlp, simple
Output types: simple
Command: /usr/bin/col
Options: MODES expand = -x
Options: INPUT simple = -p -f

In this example, the print filter program is named col. Once you add the new print filter to a print server, a user's print requests are handled as follows:

When a user types the following command:

$ lp -y expand report.doc

The print filter program is run with the following arguments to convert the file:

/usr/bin/col -x -p -f

When a user types the following command:

$ lp -T N37 -y expand report.doc

The print filter program is run with the following arguments to convert the file:

/usr/bin/col -x

Example 10-8 Creating a New Print Filter by Converting One Input Type to Another Output Type

This example shows a print filter definition that is used to convert from troff to a PostScript file.

Input types: troff
 Output types: postscript
 Printer types: PS
 Filter type: slow
 Command: /usr/lib/lp/postscript/dpost
 Options: LENGTH * = -l*
 Options: MODES port = -pp, MODES land = -pl
 Options: MODES group \=\([1-9]\) = -n\l

In this example, the filter program is named dpost. The filter program takes one input type, troff, produces a postscript output, and works with any printer of type PS (PostScript). Users need to give just the abbreviation port or land when they ask for the paper orientation to be in either portrait mode or landscape mode. Because these options are not intrinsic to the LP print service, users must specify them by using the lp -y command.

After you add the new print filter to a print server, print requests will be handled as follows: