System Administration Guide
Chapter 4, Managing printers and print jobs

About printer interface scripts

About printer interface scripts

A ``printer interface script'' is a program that the print service uses to manage the printer each time it prints a file. The interface script initializes the printer, takes advantage of its particular capabilities, prints the file, and reports any errors.

The printer interface scripts are associated with the printer model and are located in /usr/spool/lp/model. For example, the printer interface script for a PostScript® printer is called /usr/spool/lp/model/postscript. You can also create your own interface scripts or customize existing ones to suit your needs. See ``Creating printer interface scripts''.

Interface scripts:

The interface script does not open the printer port; the print service opens the printer port (or calls a dialup printer if that is how the printer is connected). The print service gives the printer port connection to the interface script as standard output and sets the printer to be the controlling terminal for the interface script. If the port experiences a hangup, a SIGHUP signal is sent to the interface script.

Many of the interface scripts provide special options that the user can specify with the -o option to lp(C). (Read the appropriate interface file for this information.) For example, the PostScript interface script includes the options listed in Table 4-5. 

Table 4-5 PostScript options

 Option       Description
 land         prints text in landscape mode
 land2        prints text in two-page landscape mode
 port         prints text in portrait mode
 raw          prints a PostScript file*

 *   Use the raw option for PostScript files only;
     the PostScript interface script converts text
     files to PostScript automatically if you do not
     specify raw.
The print service runs the interface script to send the print job to the printer:

/usr/spool/lp/admins/lp/interfaces/printer id user title copies options file1 file2 ...

Arguments to the interface script are: 

The name of the interface script (the same as the printer name).

Request-ID returned by lp.

Login name of user who made the request.

Optional title specified by the user.

Number of copies requested by the user.

List of blank-separated options, specified by the user (using lp -o) or by the print service (from default values specified by the administrator with lpadmin). See lp(C) for the list of options recognized by the standard interface.

Full pathname of a file to be printed.
When the interface script is invoked, standard input comes from /dev/null, standard output is directed to the printer port, and standard error output is directed to a file that will be displayed to the user who submitted the print request.

The print service passes additional printer configuration information to the interface script as shell variables:


Specifies the printer type. The value is used as a key for getting printer capability information from the extended terminfo database.


Specifies the filter to use to send the request content to the printer; the filter is given control of the printer.


Specifies the character set to use when printing the content of a print request. The standard interface script extracts the control sequences needed to select the character set from the terminfo database.

See also: