524 lines
9.7 KiB
HTML
524 lines
9.7 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>How it all works</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="The Printing HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Spooling software"
|
|
HREF="spoolers.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="How to set things up"
|
|
HREF="setup.html"></HEAD
|
|
><BODY
|
|
CLASS="sect1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>The Printing HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="spoolers.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="setup.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="sect1"
|
|
><H1
|
|
CLASS="sect1"
|
|
><A
|
|
NAME="background"
|
|
></A
|
|
>7. How it all works</H1
|
|
><P
|
|
>In order to get printing working well, you need to understand how your
|
|
spooling software works. All systems work in essentially the same
|
|
way, although the exact order might vary a bit, and some systems
|
|
skip a step or two:<DIV
|
|
CLASS="figure"
|
|
><A
|
|
NAME="spool-illustration"
|
|
></A
|
|
><P
|
|
><B
|
|
>Figure 10. Spooling Illustration</B
|
|
></P
|
|
><DIV
|
|
CLASS="mediaobject"
|
|
><P
|
|
><IMG
|
|
SRC="images/spool-illustration.png"></P
|
|
></DIV
|
|
></DIV
|
|
><P
|
|
></P
|
|
><OL
|
|
TYPE="1"
|
|
><LI
|
|
><P
|
|
>The user submits a job along with his selection of options. The
|
|
job data is usually, but not always, Postscript.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>The spooling system copies the job and the options over the
|
|
network in the general direction of the printer.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>The spooling system waits for the printer to be available.</P
|
|
></LI
|
|
><LI
|
|
></LI
|
|
><LI
|
|
><A
|
|
NAME="background-filtering"
|
|
></A
|
|
><P
|
|
>The spooling system applies the user's selected options to the
|
|
job, and translates the job data into the printer's native
|
|
language, which is usually not Postscript. This step is called <EM
|
|
>filtering</EM
|
|
>; most of the work in setting
|
|
things up lies in getting the proper filtering to happen.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>The job is done. The spooling system will usually do assorted
|
|
cleanup things at this point. If there was an error along the
|
|
way, the spooler will usually notify the user somehow (for
|
|
example, by email).</P
|
|
></LI
|
|
></OL
|
|
></P
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="cups-overview"
|
|
></A
|
|
>7.1. CUPS</H2
|
|
><P
|
|
>To print a job with CUPS, you can use both the BSD (see <A
|
|
HREF="printers.html#printer-compat-list"
|
|
>Section 5.3.1</A
|
|
>) and System V commands making it really easy for people with prior experience with either system.</P
|
|
><DIV
|
|
CLASS="figure"
|
|
><A
|
|
NAME="AEN1173"
|
|
></A
|
|
><P
|
|
><B
|
|
>Figure 11. Simplified CUPS illustration</B
|
|
></P
|
|
><DIV
|
|
CLASS="mediaobject"
|
|
><P
|
|
><IMG
|
|
SRC="images/cups-overview.png"></P
|
|
></DIV
|
|
></DIV
|
|
><P
|
|
>Initially CUPS lacked an LPD backend. This was of course quickly added. Currently there are backends available for at least IPP, LPD, SMB, JetDirect, USB, Netatalk, parallel and serial printers. You may find others on the net or write your own.</P
|
|
><P
|
|
>There are only a handfull of built-in drivers, allowing you to print with most printers but probably not at the maximum resolution. A PPD file for a Postscript driver can be added to CUPS but if you want to print at best quality with your fancy new HP Deskjet you are out of luck. It is here that Foomatic comes to the rescue. You can use Foomatic in combination with CUPS. Foomatic uses a CUPS filter called foomatic-rip to do its magic. foomatic-rip uses PPD files to describe printer capabilities, even for non-Postscript printers. CUPS + Foomatic is currently the recommended printing system. Some Linux distributions already use it and the number that do will only grow.</P
|
|
><P
|
|
>The CUPS scheduler does not only accept jobs, it is also a administrative webinterface. Currently you can add/delete printers, cancel jobs, start/stop printers. Moving jobs will be available in a later release.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="lpd-overview"
|
|
></A
|
|
>7.2. LPD</H2
|
|
><P
|
|
>Lpd stands for Line Printer Daemon, and refers in different
|
|
contexts to both the daemon and the whole collection of programs
|
|
which run print spooling. These are:<P
|
|
></P
|
|
><DIV
|
|
CLASS="variablelist"
|
|
><DL
|
|
><DT
|
|
><B
|
|
CLASS="command"
|
|
><A
|
|
HREF="http://www.linuxprinting.org/man/lpd.8.html"
|
|
TARGET="_top"
|
|
>lpd</A
|
|
></B
|
|
></DT
|
|
><DD
|
|
><P
|
|
>The spooling daemon. One of these runs to control everything
|
|
on a machine, AND one is run per printer while the printer is
|
|
printing.</P
|
|
></DD
|
|
><DT
|
|
><A
|
|
NAME="lpr-in-lpd-overview"
|
|
></A
|
|
><B
|
|
CLASS="command"
|
|
><A
|
|
HREF="http://www.linuxprinting.org/man/lpr.1.html"
|
|
TARGET="_top"
|
|
>lpr</A
|
|
></B
|
|
></DT
|
|
><DD
|
|
><P
|
|
>The user spooling command. Lpr contacts lpd
|
|
and injects a new print job into the spool.</P
|
|
></DD
|
|
><DT
|
|
><A
|
|
NAME="lpq-in-lpd"
|
|
></A
|
|
><B
|
|
CLASS="command"
|
|
><A
|
|
HREF="http://www.linuxprinting.org/man/lpq.1.html"
|
|
TARGET="_top"
|
|
>lpq</A
|
|
></B
|
|
></DT
|
|
><DD
|
|
><P
|
|
>Lists the jobs in a print queue.</P
|
|
></DD
|
|
><DT
|
|
><A
|
|
NAME="lpc-in-lpd"
|
|
></A
|
|
><B
|
|
CLASS="command"
|
|
><A
|
|
HREF="http://www.linuxprinting.org/man/lpc.8.html"
|
|
TARGET="_top"
|
|
>lpc</A
|
|
></B
|
|
></DT
|
|
><DD
|
|
><P
|
|
>The Lpd system control command. With lpc you can stop, start,
|
|
reorder, etc, the print queues.</P
|
|
></DD
|
|
><DT
|
|
><A
|
|
NAME="lprm-in-lpd"
|
|
></A
|
|
><B
|
|
CLASS="command"
|
|
><A
|
|
HREF="http://www.linuxprinting.org/man/lprm.1.html"
|
|
TARGET="_top"
|
|
>lprm</A
|
|
></B
|
|
></DT
|
|
><DD
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>lprm</B
|
|
> removes a job from the print spool.</P
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
></P
|
|
><P
|
|
>So how does it fit together? The following things happen:<P
|
|
></P
|
|
><OL
|
|
TYPE="1"
|
|
><LI
|
|
><P
|
|
>At boot time, <B
|
|
CLASS="command"
|
|
>lpd</B
|
|
> is run. It waits for
|
|
connections and manages printer queues.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>A user submits a job with the <B
|
|
CLASS="command"
|
|
>lpr</B
|
|
> command
|
|
or, alternatively, with an lpr front-end like GPR, PDQ, etc.<B
|
|
CLASS="command"
|
|
>Lpr</B
|
|
> contacts <B
|
|
CLASS="command"
|
|
>lpd</B
|
|
> over the
|
|
network and submits both the user's data file (containing the
|
|
print data) and a control file (containing user options).</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>When the printer becomes available, the main <B
|
|
CLASS="command"
|
|
>lpd</B
|
|
> spawns a child <B
|
|
CLASS="command"
|
|
>lpd</B
|
|
> to
|
|
handle the print job.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>The child <B
|
|
CLASS="command"
|
|
>lpd</B
|
|
> executes the appropriate
|
|
filter(s) (as specified in the <TT
|
|
CLASS="option"
|
|
>if</TT
|
|
> attribute in<TT
|
|
CLASS="filename"
|
|
>/etc/printcap</TT
|
|
>) for this job and sends the
|
|
resulting data on to the printer.</P
|
|
></LI
|
|
></OL
|
|
></P
|
|
><P
|
|
>The lp system was originally designed when most printers were line
|
|
printers - that is, people mostly printed plain ASCII. By placing
|
|
all sorts of magic in the <TT
|
|
CLASS="option"
|
|
>if</TT
|
|
> filter, modern
|
|
printing needs can be met with <B
|
|
CLASS="command"
|
|
>lpd</B
|
|
> (well, more
|
|
or less; many other systems do a better job).</P
|
|
><P
|
|
>There are many programs useful for writing LPD filters. Among
|
|
them are:<P
|
|
></P
|
|
><DIV
|
|
CLASS="variablelist"
|
|
><DL
|
|
><DT
|
|
><B
|
|
CLASS="command"
|
|
>gs</B
|
|
></DT
|
|
><DD
|
|
><P
|
|
>Ghostscript is a host-based Postscript interpreter (aka a
|
|
Raster Image Processor or RIP). It accepts Postscript and
|
|
produces output in various printer languages or a number of
|
|
graphics formats. Ghostscript is covered in <A
|
|
HREF="ghostscript.html"
|
|
>Section 10</A
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
CLASS="command"
|
|
>ppdfilt</B
|
|
></DT
|
|
><DD
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
><A
|
|
HREF="http://sourceforge.net/project/?group_id=1658"
|
|
TARGET="_top"
|
|
>ppdfilt</A
|
|
></B
|
|
> is a standalone version of a CUPS
|
|
component. It filters Postscript, executing a few basic
|
|
transformations on it (n-up printing, multiple copies, etc)
|
|
and adding in user option statements according to a Postscript
|
|
Printer Definition (PPD) file usually included with Postscript
|
|
printers.</P
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>ppdfilt</B
|
|
> is best used together with an
|
|
option-accepting LPD system (like the GNUlpr, or LPRng)
|
|
and a filter script which parses user-provided options into
|
|
the equivalent <B
|
|
CLASS="command"
|
|
>ppdfilt</B
|
|
> command. VA Linux
|
|
and HP provide a modified rhs-printfilters package which does
|
|
exactly this; it produces nice results if you have a
|
|
Postscript printer. See <A
|
|
HREF="setup.html#lpd-for-postscript-printers"
|
|
>Section 8.2.2</A
|
|
> for information on
|
|
this system.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
CLASS="command"
|
|
>ps2ps</B
|
|
></DT
|
|
><DD
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>ps2ps</B
|
|
> is a utility script included
|
|
with Ghostscript. It filters Postscript into more streamlined
|
|
Postscript, possibly at a lower Language Level. This is
|
|
useful if you have an older Postscript printer; most modern
|
|
software produces modern Postscript.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
CLASS="command"
|
|
>mpage</B
|
|
></DT
|
|
><DD
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>mpage</B
|
|
> is a utility which accepts
|
|
text or Postscript, and generates n-up output—that is,
|
|
output with several page images on each piece of paper. There
|
|
are actually several programs which do this, including<B
|
|
CLASS="command"
|
|
>enscript</B
|
|
>, <B
|
|
CLASS="command"
|
|
>nenscript</B
|
|
>, and<B
|
|
CLASS="command"
|
|
>a2ps</B
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
CLASS="command"
|
|
>a2ps</B
|
|
></DT
|
|
><DD
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>a2ps</B
|
|
>, aka any-to-ps, is a program which
|
|
accepts a variety of file types and converts them to
|
|
Postscript for printing.</P
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
></P
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="spoolers.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="setup.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Spooling software</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>How to set things up</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |