|
|
You can use filters to change the output to the printer. For example, you can create a filter that allows users to print a manual page by piping the output of man(C) to lp(C) without printing the control characters.
For example, create a file /tmp/printmandef and include this information (substitute your information for the values in bold):
Input types: nroff,man Output types: simple Printer types: any Printers: any Filter type: slow Command: col -b Options:``Printer filter definition fields'', describes each of these fields.
Enter the name of the new filter in the ``Filter Name'' field and the name of the filter definition file in the ``Filename'' field.
In our example, the filename is /tmp/printmandef, and the filter name is the name that you want the print service to assign to the form, for example, printman.
Clicking on OK in the New Filter window adds the filter definition (printman) in the /usr/spool/lp/admins/lp/filter.table file.
To use the new printman filter to print the
lpfilter(ADM)
manual page without the control characters, enter:
man lpfilter | lp -d printer_name -Tman
Here is a sample filter definition that formats an ASCII document in PostScript so that a PostScript printer can read it:
Input types: Output types: ps,postscript Printer types: laser Printers: hplaser Filter type: fast Command: /usr/spool/lp/bin/text2post Options: MODES portrait = port, MODES landscape = land, MODES landscape2 = land2To add the printps filter, proceed from step 3. To use the printps filter to print a file in landscape mode with lp(C) on the printer apple, enter:
Here is a filter definition that allows the user to define which pages to print:
Input types: simple Output types: simple Filter type: fast Command: /usr/spool/lp/bin/pages Options: PAGES * = *To add the printpage filter, proceed from step 3. To use the printpage filter to print specific pages, enter:
In this case, lp prints only pages 3 through 5 and page 9 of file on the printer laser.
Here is a filter definition that translates a PostScript file to epson format for printing on a dot matrix printer:
Input types: postscript ps Output types: epson Filter type: slow Commands: /usr/spool/lp/bin/ps2epson Options: MODES draft = -d, MODES low = -dTo add the printepson filter, proceed with step 3 of the procedure above. To use the printepson filter to print a PostScript file on the Epson dot matrix printer, enter:
To examine an existing filter, select Filters from the System menu. Then, select the filter to examine and click on Examine.
To modify an existing filter, select Filters from the System menu. Then, select the filter to modify and click on Modify. Enter the name of the modified filter definition file in the ``Filename'' field. This associates the new filter definition file with the filter name.
To remove the filter from the system, select Filters from the System menu. Then, select the filter to delete and click on Delete.
Printer filter definition fields
Field | Description |
---|---|
Input types | List of file types that the filter can process. |
Output types | List of file types that the filter can produce as output. This should match the content type of at least one printer. |
Printer types | List of printer types into which the filter can convert files. For most printers and filters, you can use the default (``any'') or leave this field blank. |
Printers | List of printers that can use this filter. For most filters, you can use the default (``any'') or leave this field blank. |
Filter type | Type of filter (either fast or slow). A fast filter is one that incurs little overhead in preparing a file or one that must have direct access to the printer. A slow filter is the opposite. The print service runs slow filters in the background, allowing files that need fast filtering (or no filtering) to be printed first. |
Command | Full pathname of the command that defines the filter program. Include any fixed options that the filter always requires. |
Options | Options to lp(C). These lp options are converted into options for the filter. |
See also:
The ``content type'' tells the print service what types of files can be printed on a particular printer type (or interface script). Most printers can print only one type of file. For them, the content type is likely to be identical to the printer type. Some printers, however, can accept several different types of file and print their contents properly. When adding this kind of printer, specify the names of the content types the printer accepts.
When a user submits a file for printing, the print service searches for a printer capable of handling the job. The print service can identify an appropriate printer through either the content type name or the printer type name.
To specify the content types that a printer can accept:
Content type names can contain no more than 14 characters and can include only letters, digits, and underscores. Choose content type names that mean something to you and the users of the printer.
If several different types of printer accept the same content type, use the same content type names when you add those printers. This makes it easier for users because they can use the same name to identify the type of file they want to print, regardless of the printing destination.
For example, several manufacturers produce printers that accept PostScript files. Although these printers might require different interface scripts so each can be properly initialized, they all might be capable of printing the same content type, which you might call PostScript. As another example, several manufacturers produce printers that accept ANSI X3.64-defined escape sequences. However, the printers might not support all the ANSI capabilities, or each might support different sets of capabilities. You can specify different content type names for these printers to differentiate them.
The print service recognizes special meanings for these content types:
If a printer can handle simple file types, include simple in the list of ``Supported'' content types. If you do not want a printer to accept simple file types, you must include an alternate list of content types that the printer accepts. (If no other content type is appropriate, use the printer interface script.)
If you do not define the types of files a printer can accept, the print service assumes the printer can print only files of content type simple. This may be sufficient if users choose the proper printer and make sure the files are properly prepared for the printer before they are submitted for printing.
Just as converting a file and handling special printing modes is printer-specific, so is printer fault detection. The print service attempts to do this in general, and for most printers, it properly detects faults. However, it is limited to checking for ``hangups'' and excessive delays in printing. The print service cannot determine the cause of the fault, so it cannot tell you exactly what to look for.
A properly designed filter can provide better fault coverage. Some printers can send a message to the host describing the reason for a fault. Others indicate a fault by dropping the carrier or shutting off data flow. A filter can serve you by giving more information about a fault and detecting more of them.
Filters can wait for a printer fault to clear and then resume printing. This allows for more efficient printing when a fault occurs because the print job that was interrupted does not have to be reprinted in its entirety. Only a filter that understands the control sequences used by a printer knows where a file breaks into pages. Thus, only the filter knows how far back to go in the file to restart properly.
The print service has a simple interface that lets the filter get the fault information to you and restart the print job if it can. The alerting mechanism is handled by the print service. The interface program that manages the filter takes all error messages from the filter and places them into an alert message that can be sent to you. Thus, you see any fault descriptions that the filter puts out. If you set the printer configuration so that printing should automatically resume after a fault is cleared, the interface program keeps the filter active so that it can pick right up where it left off.
See also: