[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Guide to Printers and Printing

Pass-Through Mode

Both virtual printers and the printer device driver can operate, or function, either in pass-through mode or in non-pass-through mode. "Pass-through mode" simply means that a data stream is "passed through" to the printer, byte by byte, unmodified. The mode of operation selected for a given job determines how or even if a data stream is processed. It is important to understand the difference between the two modes, when each mode is in effect, and if the mode can be changed.

Printer Device Driver Pass-Through Mode

The printer device driver itself, for instance /dev/lp0, by default operates in non-pass-through mode. A user can query or modify the operating rules for /dev/lp0 by issuing the splpcommand. For example, below are the results of issuing the command splp lp0 on a system with an IBM 4029 LAserPrinter defined as lp0. The results are output to the display element specified by the TERM environment variable.

device = /dev/lp0      (+ yes     ! no)
CURRENT FORMATTING PARAMETERS (ignored by qprt, lpr, and lp commands)
Note: -p + causes the other formatting parameters to be ignored.
-p !    pass-through?                   -c +    send carriage returns?
-l 64   page length (lines)             -n +    send line feeds?
-w 80   page width (columns)            -r +    carriage rtn after line fee?
-i 0    indentation (columns)           -t +    suppress tab expansion?
-W !    wrap long lines?                -b +    send backspaces?
-C !    convert to upper case?          -f +    send form feeds? 
-T 600  timeout value (seconds)         -e !    return on error? 
-B 19200baud rate                       -s 8    character size (bits) 
-N !    enable parity?                  -S !    two stop bits? 
-P !    odd parity?                   

The -p parameter determines whether or not the printer device driver, /dev/lp0, will default to a pass-through mode of operation; the mode of operation can be overridden for a specific data stream. By default, the value of the -p parameter is !, or no. It is important to note that the question asked by the -p parameter is "Will the mode of operation be pass-through mode?"

If the value of the -p parameter is !, then all of the other parameters listed are honored by the device driver during data stream processing. Likewise, if the value of the -p parameter is +, or yes, then all of the other parameters are ignored during data stream processing.

Using the splp command to change the parameter values of the printer device driver does not affect the operation of the spooler. Splp affects commands such as cat when they are used to access the device driver directly, bypassing the spooler. For example, the command

cat /etc/motd > /dev/lp0

opens /dev/lp0 and writes the contents of the "message of the day" directly to the printer. The output on the printer is formatted similar to the following example:

This is a test version of /etc/motd, used to demonstrate what happens when a
printer device driver, such as /dev/lp0, is placed into or taken out of
passthru mode.  Printers will print either exactly what they are sent, if you
set the job conditions up correctly, or, on the most current printers, you may
be able to direct the printer to perform certain mappings for you.
There are no carriage returns in this file, and the only blank line occurs
immediately before this one.

Notice that the -r parameter dictates the mapping of each linefeed to a linefeed and carriage return if the value of -p is !. This is necessary as most UNIX-based operating systems only use linefeeds; unlike DOS or OS/2 or other operating systems, in UNIX-based operating systems a linefeed implies a carriage return. While this works well with text editors and in other similar situations, it does not work with printers. Printers only print the data which they are sent. Issuing the two commands

splp -p+ lp0
cat /etc/motd > /dev/lp0

results in something like the following appearing on the printer.

This is a test version of /etc/motd, used to demonstrate what happens when a
ter device driver, such as /dev/lp0, is placed into or taken out of
                                                                   passthru mode
.  Printers will print either exactly what they are sent, if you
                                                                 set the job conditions up correctly, or, on the most current printers, you may
                                                              be able to direct
the printer to perform certain mappings for you.
                                              There are no carriage returns in
 this file, and the only blank line occurs
                                          immediately before this one.

In the first example, all of the device driver settings are honored. In particular, the mapping of a linefeed to a linefeed and a carriage return is turned on. When the device drivers is writing characters to the physical printer, it sends a carriage return after each linefeed. It also honors the settings for page width.

In the second example, the device driver is limited to simply writing each single-byte character of /etc/motd to the physical printer, without any mapping or other modification of the data stream occuring. Most ASCII printers, current or not, have enough intelligence to make a few decisions of their own. When the first sentence of /etc/motd ends, the linefeed drops the printhead straight down one line; there is no carriage return to move the printhead back to the left margin. The first four letters of the word "printer," "prin," are printed. At that point the printer itself, not the device driver, determines that the right margin has been reached and so prints a carriage return, returning the printhead to the left margin. Printing continues with the next character in the data stream.

In the second example, the job does not even print until the reset button on the printer is pressed. This is because the printer has not received enough date (characters) to automatically eject a page, and no formfeeds were sent to the printer to cause it to eject the page; the -f parameter on the device driver is ignored.

Formatter Filter Pass-Through Mode

After a job is submitted to the spooler it eventually passes to the formatter filter for processing and delivery to the printer device driver. The formatter filter always opens the printer device driver in pass-through mode. Jobs submitted to the spooler, as opposed to data streams that are sent directly to the printer device driver, are always processed or otherwise modified by a formatter filter and not by the printer device driver.

Like the printer device driver, the formatter filter also has two modes of operation: pass-through and non-pass-through. Again, the mode of operation selected for a given job determines how or even if a data stream is processed.

The _d attribute in a virtual printer definition (a digested colon file) specifies the input data stream type for the queue associated with that virtual printer. The virtual printer definition also specifies the formatter filter for that input data stream type. When the formatter filter is invoked to process a job, the process that runs the formatter (pioformat) filter checks the value of the _d attributes and decides whether or not to invoke the formatter filter in pass-through mode. If pass-through mode is selected, the formatter filter simply uses the passthru() subroutine to read the input stream and send it unmodified to the printer device driver. If pass-through mode is not selected, the formatter filter uses the lineout() subroutine to process the input data stream line by line. In either case, the printer device driver was opened for writing in pass-through mode and performs no processing on the output data stream.

Note that input data streams such as PostScript are pass-through by definition; the processing is performed by the Postscript interpreter hardware on the printer.

Most of the printer device driver parameters that one can display or modify using the splp command also exist in the formatter filter. These parameters are stored in the digested version of the colon file for a given virtual printer. For example, the mapping between the printer device driver parameters and the corresponding parameters in the colon files for an ASCII queue on an IBM 4029 LaserPrinter is as follows:

pass-through? -p _d
page length (lines) -l _l
page width (columns) -w _w
indentation (columns) -i _i
wrap long lines? -W _L
convert to uppercase? -C N/A
send carriage returns? -c _x
send linefeeds ? -n _x
carriage rtn after linefeed -r _x
suppress tab expansion? -t N/A
send backspaces? -b N/A
send formfeeds? -f _Z

The values of the parameters in the righthand column can be permanently set in the virtual printer definition. They can also be overridden at the time a job is submitted by using certain flags on either the qprt or enq commands.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]