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 acceptible to a printer, or perform various accounting or administrative functions.
+---------+ +-----+ +-----+ +--------+ +---------+
| 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 progam (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 suiteable 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.
As described in the
Print Spooling Overview,
the information in the printcap
database is used control printing
operations.
While there is no RFC specifying its format or content,
there is a strong de facto standard for its format.
For a complete description of the printcap
database see
Using the Printcap Database.
For a list of all of the printcap
and configuration options see
Index To All The Configuration and Printcap Options.
Here is a sample printcap:
lp:lp=psqueue@printserver.astart.com
This printcap information tells the client programs
that when a client wants to print a job on the
lp
printer,
that these jobs should be sent to the
psqueue
on host printerserver.astart.com
.
On the printserver,
the following printcap entry is used by the lpd
server to do the printing.
psqueue:server
:lp=/dev/lp0
:sd=/var/spool/lpd/psqueue
:if=/usr/local/bin/psfilter
The sd
(spool queue directory) entry specifies the directory where
print jobs will be placed.
The lp
line specifies an actual output device,
so the lpd
server will open this device for printing.
The if
(input file filter) entry specifies the program to be used
to translate the input file into a format compatible with the actual
printer.
Many of the times there is not need for conversion,
and this entry is left out.
The previous sections have given a very high level view of printing operations. In order to do printing the following programs and information must be established:
The following sections will cover each of these topics in turn. The initial sections assume that most users are setting up printers on small systems and require an extremely simple print capability. Later sections explore the various configurations that can be used to support large networks of print spoolers as would be found in large academic institutions or businesses.