Chapter 4. Print Spooling Tutorial

Table of Contents
4.1. Overview
4.2. Sample Printcap Entry
4.3. Setting Up the Tutorial Configuration
4.4. Restoring Original Configuration
4.5. Printing a File and Checking Status
4.6. Selecting the Print Queue
4.7. Controlling the Print Queue
4.8. Job Removal
4.9. Print Job Filters
4.10. Job File Format Conversion with Filters
4.11. Printcap Basics
4.12. Banner Printing and the OF filter
4.13. Printing from lpr Directly To A Device
4.14. Moving Jobs From Queue to Queue and Redirecting Queues
4.15. Print Job Classes, User Requested Job Priority, and Form Support
4.16. Holding and Releasing Jobs
4.17. Load Balance Queues and Printer Pools
4.18. Routing Jobs To Print Queues
4.19. Job Options and the Z Control File Entry
4.20. Interfacing to Non-LPRng Spoolers
4.21. Debugging, Tracing, and Log Files

A print spooler is a program that accepts print jobs (which are usually one or more files) from a program or network interface, stores them in a spool queue, and then sends them to a printer or another print spooler. Usually there are facilities to submit jobs, check on the current job status, remove jobs from spool queues, and perform administrative functions such as starting or stopping printing.

A print spooler is a client/server application. The client programs are used to submit jobs to the print spooler program which performs the actual printing operations. In order to carry out these operations, the server may need to use other programs to convert print job files into a format acceptable to a printer, or perform various accounting or administrative functions.

4.1. Overview

    +---------+    +-----+    +-----+     +--------+    +---------+
    | program | -> | lpr | -> | lpd |  -> | filter | -> | printer |
    +---------+    +-----+  * +-----+     +--------+    +---------+
                      *    *     |
                   printcap      V
                              +-----+     +--------+    +---------+
                              | lpd |  -> | filter | -> | printer |
                              +-----+     +--------+    +---------+
    
                               Figure 1


Figure 1 shows the flow of data between the individual components of the LPRng print spooling system. A program (or user) will use the lpr program to send a file to the lpd server over a TCP/IP connection. The lpd server will store the file temporarily in a spool queue directory. The information needed by the lpr and lpd programs to carry out this activity is stored in the printcap (usually called the /etc/printcap) database file.

The lpd server sorts the queue entries and determines the print order. It will select a job to be printed, open a connection to the printer, and then use a filter program to convert the file contents into a format suitable for the printer. If the file does not need conversion, then the lpd server will send the file directly to the printer.

The lpd server can also forward jobs to another print server over a network connection, optionally sending them through a filter as well. The destination server can in turn forward the job or send it to a printer.

The protocol or commands used to do this job forward and transfer are specified by RFC1179. This protocol specifies how the lpr client program sends a job to the lpd server, as well as how the lpd server forwards jobs to another server. In addition to job submission, RFC1179 specifies commands to obtain queue status, to remove jobs from the queue, and to start and stop print queues.