1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <chapter id="CUPS-printing">
8 <firstname>Kurt</firstname><surname>Pfeifle</surname>
10 <orgname>Danka Deutschland GmbH </orgname>
11 <address><email>kpfeifle@danka.de</email></address>
15 <firstname>Ciprian</firstname><surname>Vizitiu</surname>
17 <address><email>CVizitiu@gbif.org</email></address>
19 <contrib>drawings</contrib>
22 <author>&person.jelmer;<contrib>drawings</contrib></author>
24 <pubdate> (27 Jan 2004) </pubdate>
27 <title>CUPS Printing Support</title>
31 <title>Introduction</title>
34 <title>Features and Benefits</title>
37 <indexterm><primary>default printing</primary></indexterm>
38 The Common UNIX Print System (<ulink url="http://www.cups.org/">CUPS</ulink>)
39 has become quite popular. All major Linux distributions now ship it as their default printing
40 system. To many, it is still a mystical tool. Mostly, it just works. People tend to regard
41 it as a <quote>black box</quote> that they do not want to look into as long as it works. But once
42 there is a little problem, they have trouble finding out where to start debugging it. Refer to
43 <link linkend="classicalprinting">Classical Printing</link>, which contains much information
44 that is also relevant to CUPS.
48 <indexterm><primary>CUPS</primary></indexterm>
49 CUPS sports quite a few unique and powerful features. While its basic functions may be grasped quite
50 easily, they are also new. Because it is different from other, more traditional printing systems, it is best
51 not to try to apply any prior knowledge about printing to this new system. Rather, try to understand CUPS from
52 the beginning. This documentation will lead you to a complete understanding of CUPS. Let's start with the most
59 <title>Overview</title>
62 <indexterm><primary>print spooling system</primary></indexterm>
63 <indexterm><primary>CUPS</primary></indexterm>
64 <indexterm><primary>printer management system</primary></indexterm>
65 <indexterm><primary>IETF</primary></indexterm>
66 <indexterm><primary>Internet Printing Protocol</primary><see>IPP</see></indexterm>
67 <indexterm><primary>Internet Engineering Task Force</primary><see>IETF</see></indexterm>
68 <indexterm><primary>GUI</primary></indexterm>
69 <indexterm><primary>KDEPrint</primary></indexterm>
70 CUPS is more than just a print spooling system. It is a complete printer management system that
71 complies with the new Internet Printing Protocol (IPP). IPP is an industry and Internet Engineering Task Force
72 (IETF) standard for network printing. Many of its functions can be managed remotely (or locally) via a Web
73 browser (giving you platform-independent access to the CUPS print server). Additionally, it has the
74 traditional command line and several more modern GUI interfaces (GUI interfaces developed by third parties,
75 like KDE's overwhelming <ulink url="http://printing.kde.org/">KDEPrint</ulink>).
79 <indexterm><primary>raw printers</primary></indexterm>
80 <indexterm><primary>smart printers</primary></indexterm>
81 CUPS allows creation of <emphasis>raw</emphasis> printers (i.e., no print file format translation) as
82 well as <emphasis>smart</emphasis> printers (i.e., CUPS does file format conversion as required for the
83 printer). In many ways, this gives CUPS capabilities similar to the MS Windows print monitoring system. Of
84 course, if you are a CUPS advocate, you would argue that CUPS is better! In any case, let us now explore how
85 to configure CUPS for interfacing with MS Windows print clients via Samba.
93 <title>Basic CUPS Support Configuration</title>
96 <indexterm><primary>CUPS</primary></indexterm>
97 <indexterm><primary>cupsd.conf</primary></indexterm>
98 <indexterm><primary>/etc/printcap</primary></indexterm>
99 <indexterm><primary>Printcap</primary></indexterm>
100 <indexterm><primary>PrintcapFormat</primary></indexterm>
101 Printing with CUPS in the most basic &smb.conf; setup in Samba-3.0 (as was true for 2.2.x) requires just two
102 parameters: <smbconfoption name="printing">cups</smbconfoption> and <smbconfoption
103 name="printcap">cups</smbconfoption>. CUPS does not need a printcap file. However, the
104 <filename>cupsd.conf</filename> configuration file knows of two related directives that control how such a
105 file will be automatically created and maintained by CUPS for the convenience of third-party applications
106 (example: <parameter>Printcap /etc/printcap</parameter> and <parameter>PrintcapFormat BSD</parameter>).
107 Legacy programs often require the existence of a printcap file containing printer names or they will refuse to
108 print. Make sure CUPS is set to generate and maintain a printcap file. For details, see <command>man
109 cupsd.conf</command> and other CUPS-related documentation, like the wealth of documents regarding the CUPS
110 server itself available from the <ulink noescape="1"
111 url="http://localhost:631/documentation.html">CUPS</ulink> web site.
115 <title>Linking smbd with libcups.so</title>
118 <indexterm><primary>libcups.so</primary></indexterm>
119 Samba has a special relationship to CUPS. Samba can be compiled with CUPS library support.
120 Most recent installations have this support enabled. By default, CUPS linking is compiled
121 into smbd and other Samba binaries. Of course, you can use CUPS even
122 if Samba is not linked against <filename>libcups.so</filename> &smbmdash; but
123 there are some differences in required or supported configuration.
127 <indexterm><primary>libcups</primary></indexterm>
128 <indexterm><primary>ldd</primary></indexterm>
129 When Samba is compiled and linked with <filename>libcups</filename>, <smbconfoption name="printcap">cups</smbconfoption>
130 uses the CUPS API to list printers, submit jobs, query queues, and so on. Otherwise it maps to the System V
131 commands with an additional <command>-oraw</command> option for printing. On a Linux
132 system, you can use the <command>ldd</command> utility to find out if smbd has been linked with the
133 libcups library (<command>ldd</command> may not be present on other OS platforms, or its function may be embodied
134 by a different command):
136 &rootprompt;<userinput>ldd `which smbd`</userinput>
137 libssl.so.0.9.6 => /usr/lib/libssl.so.0.9.6 (0x4002d000)
138 libcrypto.so.0.9.6 => /usr/lib/libcrypto.so.0.9.6 (0x4005a000)
139 libcups.so.2 => /usr/lib/libcups.so.2 (0x40123000)
145 <indexterm><primary>libcups.so.2</primary></indexterm>
146 The line <computeroutput>libcups.so.2 => /usr/lib/libcups.so.2 (0x40123000)</computeroutput> shows
147 there is CUPS support compiled into this version of Samba. If this is the case, and printing = cups
148 is set, then <emphasis>any otherwise manually set print command in &smb.conf; is ignored</emphasis>.
149 This is an important point to remember!
152 <tip><para> Should it be necessary, for any reason, to set your own print commands, you can do this by setting
153 <smbconfoption name="printing">sysv</smbconfoption>. However, you will lose all the benefits
154 of tight CUPS-Samba integration. When you do this, you must manually configure the printing system commands
156 <smbconfoption name="print command"/>; other commands are
157 <smbconfoption name="lppause command"/>,
158 <smbconfoption name="lpresume command"/>,
159 <smbconfoption name="lpq command"/>,
160 <smbconfoption name="lprm command"/>,
161 <smbconfoption name="queuepause command"/> and
162 <smbconfoption name="queue resume command"/>).
168 <title>Simple &smb.conf; Settings for CUPS</title>
171 To summarize, <link linkend="cups-exam-simple">the Simplest Printing-Related
172 &smb.conf; file</link> shows the simplest printing-related setup for &smb.conf; to
173 enable basic CUPS support:
176 <example id="cups-exam-simple">
177 <title>Simplest Printing-Related smb.conf</title>
179 <smbconfsection name="[global]"/>
180 <smbconfoption name="load printers">yes</smbconfoption>
181 <smbconfoption name="printing">cups</smbconfoption>
182 <smbconfoption name="printcap name">cups</smbconfoption>
184 <smbconfsection name="[printers]"/>
185 <smbconfoption name="comment">All Printers</smbconfoption>
186 <smbconfoption name="path">/var/spool/samba</smbconfoption>
187 <smbconfoption name="browseable">no</smbconfoption>
188 <smbconfoption name="guest ok">yes</smbconfoption>
189 <smbconfoption name="writable">no</smbconfoption>
190 <smbconfoption name="printable">yes</smbconfoption>
195 <indexterm><primary>PDF</primary></indexterm>
196 <indexterm><primary>PostScript</primary></indexterm>
197 <indexterm><primary>printer driver</primary></indexterm>
198 This is all you need for basic printing setup for CUPS. It will print all graphic, text, PDF, and PostScript
199 files submitted from Windows clients. However, most of your Windows users would not know how to send these
200 kinds of files to print without opening a GUI application. Windows clients tend to have local printer drivers
201 installed, and the GUI application's print buttons start a printer driver. Your users also rarely send files
202 from the command line. Unlike UNIX clients, they rarely submit graphic, text, or PDF formatted files directly
203 to the spooler. They nearly exclusively print from GUI applications with a <quote>printer driver</quote>
204 hooked between the application's native format and the print data stream. If the backend printer is not a
205 PostScript device, the print data stream is <quote>binary,</quote> sensible only for the target printer. Read
206 on to learn what problem this may cause and how to avoid it.
212 <title>More Complex CUPS &smb.conf; Settings</title>
215 <link linkend="overridesettings">The Overriding Global CUPS Settings for One Printer example</link>
216 is a slightly more complex printing-related setup for &smb.conf;. It enables general CUPS printing
217 support for all printers, but defines one printer share, which is set up differently.
220 <example id="overridesettings">
221 <title>Overriding Global CUPS Settings for One Printer</title>
223 <smbconfsection name="[global]"/>
224 <smbconfoption name="printing">cups</smbconfoption>
225 <smbconfoption name="printcap name">cups</smbconfoption>
226 <smbconfoption name="load printers">yes</smbconfoption>
228 <smbconfsection name="[printers]"/>
229 <smbconfoption name="comment">All Printers</smbconfoption>
230 <smbconfoption name="path">/var/spool/samba</smbconfoption>
231 <smbconfoption name="guest ok">yes</smbconfoption>
232 <smbconfoption name="writable">no</smbconfoption>
233 <smbconfoption name="printable">yes</smbconfoption>
235 <smbconfsection name="[special_printer]"/>
236 <smbconfoption name="comment">A special printer with his own settings</smbconfoption>
237 <smbconfoption name="path">/var/spool/samba-special</smbconfoption>
238 <smbconfoption name="printing">sysv</smbconfoption>
239 <smbconfoption name="printcap">lpstat</smbconfoption>
240 <smbconfoption name="print command">echo "NEW: `date`: printfile %f" >> /tmp/smbprn.log ; echo " `date`: p-%p s-%s f-%f" >> /tmp/smbprn.log ; echo " `date`: j-%j J-%J z-%z c-%c" >> /tmp/smbprn.log ; rm %f </smbconfoption>
241 <smbconfoption name="guest ok">no</smbconfoption>
242 <smbconfoption name="writable">no</smbconfoption>
243 <smbconfoption name="printable">yes</smbconfoption>
244 <smbconfoption name="hosts deny">0.0.0.0</smbconfoption>
245 <smbconfoption name="hosts allow">turbo_xp, 10.160.50.23, 10.160.51.60</smbconfoption>
250 This special share is only for testing purposes. It does not write the print job to a file. It just logs the job parameters
251 known to Samba into the <filename>/tmp/smbprn.log</filename> file and deletes the job-file. Moreover, guest access is not
252 allowed, the share isn't published to the Network Neighborhood (so you need to know it is there), and it
253 allows access from only three hosts. To prevent CUPS from kicking in and taking over the print jobs for that share, we need to set
254 <smbconfoption name="printing">sysv</smbconfoption> and <smbconfoption name="printcap">lpstat</smbconfoption>.
262 <title>Advanced Configuration</title>
265 Before we delve into all the configuration options, let us clarify a few points. <emphasis>Network printing
266 needs to be organized and set up correctly</emphasis>. This frequently doesn't happen. Legacy systems or small
267 business LAN environments often lack design and good housekeeping.
272 <title>Central Spooling vs. <quote>Peer-to-Peer</quote> Printing</title>
276 <indexterm><primary>spooling</primary></indexterm>
277 <indexterm><primary>spooling</primary><secondary>central</secondary></indexterm>
278 <indexterm><primary>spooling</primary><secondary>peer-to-peer</secondary></indexterm>
279 Many small office or home networks, as well as badly organized larger environments, allow each client a direct
280 access to available network printers. This is generally a bad idea. It often blocks one client's access to the
281 printer when another client's job is printing. It might freeze the first client's application while it is
282 waiting to get rid of the job. Also, there are frequent complaints about various jobs being printed with their
283 pages mixed with each other. A better concept is the use of a print server: it routes all jobs through one
284 central system, which responds immediately, takes jobs from multiple concurrent clients, and transfers them to
285 the printer(s) in the correct order.
291 <title>Raw Print Serving: Vendor Drivers on Windows Clients</title>
294 <indexterm><primary>spooling-only</primary></indexterm>
295 <indexterm><primary>raw printing</primary></indexterm>
296 Most traditionally configured UNIX print servers acting on behalf of
297 Samba's Windows clients represented a really simple setup. Their only
298 task was to manage the <quote>raw</quote> spooling of all jobs handed to them by
299 Samba. This approach meant that the Windows clients were expected to
300 prepare the print job file that is ready to be sent to the printing
301 device. In this case, a native (vendor-supplied) Windows printer driver needs to
302 be installed on each and every client for the target device.
306 <indexterm><primary>render</primary></indexterm>
307 <indexterm><primary>vendor-provided drivers</primary></indexterm>
308 It is possible to configure CUPS, Samba, and your Windows clients in the
309 same traditional and simple way. When CUPS printers are configured
310 for raw print-through mode operation, it is the responsibility of the
311 Samba client to fully render the print job (file). The file must be
312 sent in a format that is suitable for direct delivery to the
313 printer. Clients need to run the vendor-provided drivers to do
314 this. In this case, CUPS will not do any print file format conversion
319 The easiest printing configuration possible is raw print-through.
320 This is achieved by installation of the printer as if it were physically
321 attached to the Windows client. You then redirect output to a raw network
322 print queue. This procedure may be followed to achieve this:
326 <title>Configuration Steps for Raw CUPS Printing Support</title>
329 <indexterm><primary>/etc/cups/mime.types</primary></indexterm>
330 Edit <filename>/etc/cups/mime.types</filename> to uncomment the line
331 near the end of the file that has:
333 #application/octet-...
338 <indexterm><primary>/etc/cups/mime.convs</primary></indexterm>
339 Do the same for the file <filename>/etc/cups/mime.convs</filename>.
343 Add a raw printer using the Web interface. Point your browser at
344 <constant>http://localhost:631</constant>. Enter Administration, and add
345 the printer following the prompts. Do not install any drivers for it.
346 Choose Raw. Choose queue name <constant>Raw Queue</constant>.
350 In the &smb.conf; file <constant>[printers]</constant> section add
351 <smbconfoption name="use client driver">Yes</smbconfoption>,
352 and in the <constant>[global]</constant> section add
353 <smbconfoption name="printing">CUPS</smbconfoption>, plus
354 <smbconfoption name="printcap">CUPS</smbconfoption>.
358 Install the printer as if it is a local printer, that is, Printing to <constant>LPT1:</constant>.
362 Edit the configuration under the <guimenu>Detail</guimenu> tab and create a
363 <constant>local port</constant> that points to the raw printer queue that
364 you have configured above. Example: <constant>\\server\raw_q</constant>.
365 Here, the name <constant>raw_q</constant> is the name you gave the print
366 queue in the CUPS environment.
373 <title>Installation of Windows Client Drivers</title>
376 The printer drivers on the Windows clients may be installed
377 in two functionally different ways:
381 <listitem><para>Manually install the drivers locally on each client,
382 one by one; this yields the old LanMan style
383 printing and uses a <filename>\\sambaserver\printershare</filename>
384 type of connection.</para></listitem>
388 <indexterm><primary>point 'n' print</primary></indexterm>
389 Deposit and prepare the drivers (for later download) on
390 the print server (Samba); this enables the clients to use
391 <quote>Point'n'Print</quote> to get drivers semi-automatically installed the
392 first time they access the printer; with this method NT/200x/XP
393 clients use the <emphasis>SPOOLSS/MS-RPC</emphasis>
394 type printing calls.</para></listitem>
398 The second method is recommended for use over the first as it reduces the
399 administrative efforts and prevents that different versions of the drivers
400 are used accidentally.
404 <sect2 id="cups-raw">
405 <title>Explicitly Enable <quote>raw</quote> Printing for <emphasis>application/octet-stream</emphasis></title>
409 <indexterm><primary>application/octet-stream</primary></indexterm>
410 <indexterm><primary>raw printing</primary></indexterm>
411 <indexterm><primary>MIME</primary><secondary>raw</secondary></indexterm>
412 If you use the first option (drivers are installed on the client
413 side), there is one setting to take care of: CUPS needs to be told
414 that it should allow <quote>raw</quote> printing of deliberate (binary) file
415 formats. The CUPS files that need to be correctly set for raw mode
416 printers to work are:
420 <listitem><para><filename>/etc/cups/mime.types</filename></para></listitem>
421 <listitem><para><filename>/etc/cups/mime.convs</filename></para></listitem>
425 Both contain entries (at the end of the respective files) that must be uncommented to allow RAW mode
426 operation. In <filename>/etc/cups/mime.types</filename>, make sure this line is present:
428 application/octet-stream
430 <indexterm><primary>/etc/cups/mime.convs</primary></indexterm>
431 <indexterm><primary>/etc/cups/mime.types</primary></indexterm>
432 In <filename>/etc/cups/mime.convs</filename>, have this line:
433 <indexterm><primary>application/vnd.cups-raw</primary></indexterm>
435 application/octet-stream application/vnd.cups-raw 0 -
437 If these two files are not set up correctly for raw Windows client
438 printing, you may encounter the dreaded <computeroutput>Unable to
439 convert file 0</computeroutput> in your CUPS <filename>error_log</filename> file.
443 Editing the <filename>mime.convs</filename> and the <filename>mime.types</filename> file does
444 not <emphasis>enforce</emphasis> <quote>raw</quote> printing, it only <emphasis>allows</emphasis> it.
447 <formalpara><title>Background</title>
450 <indexterm><primary>application/octet-stream</primary></indexterm>
451 <indexterm><primary>MIME type</primary></indexterm>
452 That CUPS is a more security-aware printing system than traditional ones does not by default allow a user to
453 send deliberate (possibly binary) data to printing devices. This could be easily abused to launch a
454 <quote>Denial of Service</quote> attack on your printer(s), causing at least the loss of a lot of paper and
455 ink. <quote>Unknown</quote> data are tagged by CUPS as <parameter>MIME type: application/octet-stream</parameter>
456 and not allowed to go to the printer. By default, you can only send other (known) MIME types <quote>raw.</quote>
457 Sending data <quote>raw</quote> means that CUPS does not try to convert them and passes them to the printer
463 This is all you need to know to get the CUPS/Samba combo printing
464 <quote>raw</quote> files prepared by Windows clients, which have vendor drivers
465 locally installed. If you are not interested in background information about
466 more advanced CUPS/Samba printing, simply skip the remaining sections
473 <title>Driver Upload Methods</title>
476 This section describes three familiar methods, plus one new one, by which
477 printer drivers may be uploaded.
481 <indexterm><primary>point'n'print</primary></indexterm>
482 If you want to use the MS-RPC-type printing, you must upload the
483 drivers onto the Samba server first (<smbconfsection name="[print$]"/>
484 share). For a discussion on how to deposit printer drivers on the
485 Samba host (so the Windows clients can download and use them via
486 <quote>Point'n'Print</quote>), please refer to the <link linkend="classicalprinting">Classical Printing
487 chapter</link> of this book. There you will find a description or reference to
488 three methods of preparing the client drivers on the Samba server:
493 <indexterm><primary>add printer wizard</primary></indexterm>
494 The GUI, <quote>Add Printer Wizard</quote> <emphasis>upload-from-a-Windows-client</emphasis> method.
498 The command line, <quote>smbclient/rpcclient</quote> upload-from-a-UNIX-workstation method.
502 <indexterm><primary>imprints</primary></indexterm>
503 The Imprints tool set method.
508 <indexterm><primary>cupsaddsmb</primary></indexterm>
509 These three methods apply to CUPS all the same. The <command>cupsaddsmb</command> utility is a new and more
510 convenient way to load the Windows drivers into Samba and is provided if you use CUPS.
514 <command>cupsaddsmb</command> is discussed in much detail later in this chapter. But we first
515 explore the CUPS filtering system and compare the Windows and UNIX printing architectures.
523 <title>Advanced Intelligent Printing with PostScript Driver Download</title>
526 <indexterm><primary>PostScript</primary><seealso>Ghostscript</seealso></indexterm>
527 We now know how to set up a <quote>dump</quote> print server, that is, a server that spools
528 print jobs <quote>raw</quote>, leaving the print data untouched.
532 You might need to set up CUPS in a smarter way. The reasons could be manifold:
535 <indexterm><primary>print statistics</primary></indexterm>
536 <indexterm><primary>average print run</primary></indexterm>
537 <indexterm><primary>print quota</primary></indexterm>
539 <listitem><para>Maybe your boss wants to get monthly statistics: Which
540 printer did how many pages? What was the average data size of a job?
541 What was the average print run per day? What are the typical hourly
542 peaks in printing? Which department prints how much?</para></listitem>
544 <listitem><para>Maybe you are asked to set up a print quota system:
545 Users should not be able to print more jobs once they have surpassed
546 a given limit per period.</para></listitem>
548 <listitem><para>Maybe your previous network printing setup is a mess
549 and must be re-organized from a clean beginning.</para></listitem>
551 <listitem><para>Maybe you are experiencing too many <quote>blue screens</quote>
552 originating from poorly debugged printer drivers running in NT <quote>kernel mode</quote>?</para></listitem>
556 These goals cannot be achieved by a raw print server. To build a
557 server meeting these requirements, you'll first need to learn
558 how CUPS works and how you can enable its features.
562 What follows is the comparison of some fundamental concepts for
563 Windows and UNIX printing, then a description of the
564 CUPS filtering system, how it works, and how you can tweak it.
568 <title>GDI on Windows, PostScript on UNIX</title>
571 <indexterm><primary>GDI</primary></indexterm>
572 <indexterm><primary>PostScript</primary></indexterm>
573 Network printing is one of the most complicated and error-prone
574 day-to-day tasks any user or administrator may encounter. This is
575 true for all OS platforms, and there are reasons it is so.
580 <indexterm><primary>PCL</primary></indexterm>
581 <indexterm><primary>PDL</primary></indexterm>
582 <indexterm><primary>PostScript</primary></indexterm>
583 <indexterm><primary>Adobe</primary></indexterm>
584 <indexterm><primary>page description languages</primary><see>PDL</see></indexterm>
585 You can't expect to throw just any file format at a printer and have it get printed. A file format conversion
586 must take place. The problem is that there is no common standard for print file formats across all
587 manufacturers and printer types. While PostScript (trademark held by Adobe) and, to an extent, PCL (trademark
588 held by Hewlett-Packard) have developed into semi-official <quote>standards</quote> by being the most widely
589 used page description languages (PDLs), there are still many manufacturers who <quote>roll their own</quote>
590 (their reasons may be unacceptable license fees for using printer-embedded PostScript interpreters, and so on).
596 <title>Windows Drivers, GDI, and EMF</title>
599 <indexterm><primary>GDI</primary></indexterm>
600 <indexterm><primary>EMF</primary></indexterm>
601 <indexterm><primary>WYSIWYG</primary></indexterm>
602 <indexterm><primary>Enhanced MetaFile</primary><see>EMF</see></indexterm>
603 In Windows OS, the format conversion job is done by the printer drivers. On MS Windows OS platforms all
604 application programmers have at their disposal a built-in API, the graphical device interface (GDI), as part
605 and parcel of the OS itself to base themselves on. This GDI core is used as one common unified ground for all
606 Windows programs to draw pictures, fonts, and documents <emphasis>on screen</emphasis> as well as <emphasis>on
607 paper</emphasis> (print). Therefore, printer driver developers can standardize on a well-defined GDI output
608 for their own driver input. Achieving WYSIWYG (What You See Is What You Get) is relatively easy, because the
609 on-screen graphic primitives, as well as the on-paper drawn objects, come from one common source. This source,
610 the GDI, often produces a file format called Enhanced MetaFile (EMF). The EMF is processed by the printer
611 driver and converted to the printer-specific file format.
615 <indexterm><primary>PDF</primary></indexterm>
616 <indexterm><primary>Xprint</primary></indexterm>
617 <indexterm><primary>core graphic engine</primary></indexterm>
618 To the GDI foundation in MS Windows, Apple has chosen to put paper and screen output on a common foundation
619 for its (BSD-UNIX-based, did you know?) Mac OS X and Darwin operating <indexterm><primary>X Window
620 System</primary></indexterm> <indexterm><primary>PostScript</primary></indexterm>
621 <indexterm><primary>PCL</primary></indexterm> <indexterm><primary>Xprint</primary></indexterm> systems.
622 Apple's <emphasis>core graphic engine</emphasis> uses a <emphasis>PDF</emphasis> derivative for all display work.
626 The example in <link linkend="f1small">Windows Printing to a Local Printer</link> illustrates local Windows
630 <figure id="f1small">
631 <title>Windows Printing to a Local Printer.</title>
632 <imagefile>1small</imagefile>
638 <title>UNIX Printfile Conversion and GUI Basics</title>
641 <indexterm><primary>X Window System</primary></indexterm>
642 <indexterm><primary>PostScript</primary></indexterm>
643 <indexterm><primary>PCL</primary></indexterm>
644 <indexterm><primary>Xprint</primary></indexterm>
645 In UNIX and Linux, there is no comparable layer built into the OS kernel(s) or the X (screen display) server.
646 Every application is responsible for itself to create its print output. Fortunately, most use PostScript and
647 that at least gives some common ground. Unfortunately, there are many different levels of quality for this
648 PostScript. And worse, there is a huge difference (and no common root) in the way the same document is
649 displayed on screen and how it is presented on paper. WYSIWYG is more difficult to achieve. This goes back to
650 the time, decades ago, when the predecessors of X.org, designing the UNIX foundations and protocols for
651 graphical user interfaces, refused to take responsibility for <quote>paper output</quote>, as some had
652 demanded at the time, and restricted itself to <quote>on-screen only.</quote> (For some years now, the
653 <quote>Xprint</quote> project has been under development, attempting to build printing support into the X
654 framework, including a PostScript and a PCL driver, but it is not yet ready for prime time.) You can see this
655 unfavorable inheritance up to the present day by looking into the various <quote>font</quote> directories on
656 your system; there are separate ones for fonts used for X display and fonts to be used on paper.
660 <title>Background</title>
663 <indexterm><primary>PostScript</primary></indexterm>
664 <indexterm><primary>color</primary></indexterm>
665 <indexterm><primary>linewidth</primary></indexterm>
666 <indexterm><primary>scale</primary></indexterm>
667 <indexterm><primary>distort</primary></indexterm>
668 <indexterm><primary>rotate</primary></indexterm>
669 <indexterm><primary>shift</primary></indexterm>
670 <indexterm><primary>raster images</primary></indexterm>
671 <indexterm><primary>display PostScript</primary></indexterm>
672 <indexterm><primary>graphical objects</primary></indexterm>
673 The PostScript programming language is an <quote>invention</quote> by Adobe, but its specifications have been
674 published extensively. Its strength lies in its powerful abilities to describe graphical objects (fonts,
675 shapes, patterns, lines, curves, and dots), their attributes (color, linewidth), and the way to manipulate
676 (scale, distort, rotate, shift) them. Because of its open specification, anybody with the skill can start
677 writing his or her own implementation of a PostScript interpreter and use it to display PostScript files on
678 screen or on paper. Most graphical output devices are based on the concept of <quote>raster images</quote> or
679 <quote>pixels</quote> (one notable exception is pen plotters). Of course, you can look at a PostScript file in
680 its textual form and you will be reading its PostScript code, the language instructions that need to be
681 interpreted by a rasterizer. Rasterizers produce pixel images, which may be displayed on screen by a viewer
682 program or on paper by a printer.
687 <sect2 id="post-and-ghost">
688 <title>PostScript and Ghostscript</title>
691 <indexterm><primary>PostScript</primary></indexterm>
692 <indexterm><primary>GhostScript</primary><seealso>PostScript</seealso></indexterm>
693 <indexterm><primary>PostScript</primary><secondary>RIP</secondary></indexterm>
694 <indexterm><primary>PostScript interpreter</primary></indexterm>
695 <indexterm><primary>raster image processor</primary><see>RIP</see></indexterm>
696 So UNIX is lacking a common ground for printing on paper and displaying on screen. Despite this unfavorable
697 legacy for UNIX, basic printing is fairly easy if you have PostScript printers at your disposal. The reason is
698 that these devices have a built-in PostScript language <quote>interpreter,</quote> also called a raster image
699 processor (RIP), (which makes them more expensive than other types of printers; throw PostScript toward them,
700 and they will spit out your printed pages. The RIP does all the hard work of converting the PostScript drawing
701 commands into a bitmap picture as you see it on paper, in a resolution as done by your printer. This is no
702 different than PostScript printing a file from a Windows origin.
706 <indexterm><primary>PPD</primary></indexterm>
707 <indexterm><primary>PPD-aware</primary></indexterm>
708 <indexterm><primary>PostScript Printer Description</primary><see>PPD</see></indexterm>
709 Traditional UNIX programs and printing systems &smbmdash; while using PostScript &smbmdash; are largely not
710 PPD-aware. PPDs are <quote>PostScript Printer Description</quote> files. They enable you to specify and
711 control all options a printer supports: duplexing, stapling, and punching. Therefore, UNIX users for a long
712 time couldn't choose many of the supported device and job options, unlike Windows or Apple users. But now
713 there is CUPS. as illustrated in <link linkend="f2small">Printing to a PostScript Printer</link>.
717 <figure id="f2small">
718 <title>Printing to a PostScript Printer.</title>
719 <imagefile>2small</imagefile>
723 <indexterm><primary>PDL</primary></indexterm>
724 However, there are other types of printers out there. These do not know how to print PostScript. They use
725 their own PDL, often proprietary. To print to them is much more demanding. Since your UNIX applications mostly
726 produce PostScript, and since these devices do not understand PostScript, you need to convert the print files
727 to a format suitable for your printer on the host before you can send it away.
733 <title>Ghostscript: The Software RIP for Non-PostScript Printers</title>
736 <indexterm><primary>GhostScript</primary></indexterm>
737 Here is where Ghostscript kicks in. Ghostscript is the traditional (and quite powerful) PostScript interpreter
738 used on UNIX platforms. It is a RIP in software, capable of doing a <emphasis>lot</emphasis> of file format
739 conversions for a very broad spectrum of hardware devices as well as software file formats. Ghostscript
740 technology and drivers are what enable PostScript printing to non-PostScript hardware. This is shown in
741 <link linkend="f3small">Ghostscript as a RIP for Non-PostScript Printers</link>.
744 <figure id="f3small">
745 <title>Ghostscript as a RIP for Non-PostScript Printers.</title>
746 <imagefile>3small</imagefile>
750 <indexterm><primary>PNG</primary></indexterm>
751 <indexterm><primary>AFPL</primary></indexterm>
752 <indexterm><primary>ESP</primary></indexterm>
753 Use the <quote>gs -h</quote> command to check for all built-in <quote>devices</quote> on your Ghostscript
754 version. If you specify a parameter of <parameter>-sDEVICE=png256</parameter> on your Ghostscript command
755 line, you are asking Ghostscript to convert the input into a PNG file. Naming a <quote>device</quote> on the
756 command line is the most important single parameter to tell Ghostscript exactly how it should render the
757 input. New Ghostscript versions are released at fairly regular intervals, now by artofcode LLC. They are
758 initially put under the <quote>AFPL</quote> license, but re-released under the GNU GPL as soon as the next
759 AFPL version appears. GNU Ghostscript is probably the version installed on most Samba systems. But it has some
760 deficiencies. <indexterm><primary>Ghostscript</primary><secondary>ESP</secondary><see>ESP
761 GhostScript</see></indexterm> Therefore, ESP Ghostscript was developed as an enhancement over GNU Ghostscript,
762 with lots of bug-fixes, additional devices, and improvements. It is jointly maintained by developers from
763 CUPS, Gutenprint, MandrakeSoft, SuSE, Red Hat, and Debian. It includes the <quote>cups</quote> device
764 (essential to print to non-PS printers from CUPS).
770 <title>PostScript Printer Description (PPD) Specification</title>
773 <indexterm><primary>PPD</primary></indexterm>
774 <indexterm><primary>PDL</primary></indexterm>
775 <indexterm><primary>PostScript</primary></indexterm>
776 While PostScript in essence is a PDL to represent the page layout in a device-independent way, real-world
777 print jobs are always ending up being output on hardware with device-specific features. To take care of all
778 the differences in hardware and to allow for innovations, Adobe has specified a syntax and file format for
779 PostScript Printer Description (PPD) files. Every PostScript printer ships with one of these files.
783 PPDs contain all the information about general and special features of the
784 given printer model: Which different resolutions can it handle? Does
785 it have a duplexing unit? How many paper trays are there? What media
786 types and sizes does it take? For each item, it also names the special
787 command string to be sent to the printer (mostly inside the PostScript
788 file) in order to enable it.
792 Information from these PPDs is meant to be taken into account by the
793 printer drivers. Therefore, installed as part of the Windows
794 PostScript driver for a given printer is the printer's PPD. Where it
795 makes sense, the PPD features are presented in the drivers' UI dialogs
796 to display to the user a choice of print options. In the end, the
797 user selections are somehow written (in the form of special
798 PostScript, PJL, JCL, or vendor-dependent commands) into the PostScript
799 file created by the driver.
803 <indexterm><primary>PDF</primary></indexterm>
804 <indexterm><primary>PDF distilling</primary></indexterm>
805 A PostScript file that was created to contain device-specific commands
806 for achieving a certain print job output (e.g., duplexed, stapled, and
807 punched) on a specific target machine may not print as expected, or
808 may not be printable at all on other models; it also may not be fit
809 for further processing by software (e.g., by a PDF distilling program).
814 <title>Using Windows-Formatted Vendor PPDs</title>
817 <indexterm><primary>CUPS</primary></indexterm>
818 <indexterm><primary>PPDs</primary></indexterm>
819 <indexterm><primary>PostScript</primary></indexterm>
820 CUPS can handle all spec-compliant PPDs as supplied by the manufacturers for their PostScript models. Even if
821 a vendor does not mention our favorite OS in his or her manuals and brochures, you can safely trust this:
822 <emphasis>If you get the Windows NT version of the PPD, you can use it unchanged in CUPS</emphasis> and thus
823 access the full power of your printer just like a Windows NT user could!
827 To check the spec compliance of any PPD online, go to <ulink noescape="1"
828 url="http://www.cups.org/testppd.php">http://www.cups.org/testppd.php</ulink> and upload your PPD. You will
829 see the results displayed immediately. CUPS in all versions after 1.1.19 has a much stricter internal PPD
830 parsing and checking code enabled; in case of printing trouble, this online resource should be one of your
835 <indexterm><primary>foomatic</primary></indexterm>
836 <indexterm><primary>cupsomatic</primary></indexterm>
837 For real PostScript printers, <emphasis>do not</emphasis> use the <emphasis>Foomatic</emphasis> or
838 <emphasis>cupsomatic</emphasis> PPDs from Linuxprinting.org. With these devices, the original vendor-provided
839 PPDs are always the first choice.
843 <indexterm><primary>W32X86/2</primary></indexterm>
844 If you are looking for an original vendor-provided PPD of a specific device, and you know that an NT4 box (or
845 any other Windows box) on your LAN has the PostScript driver installed, just use <command>smbclient
846 //NT4-box/print\$ -U username</command> to access the Windows directory where all printer driver files are
847 stored. First look in the <filename>W32X86/2</filename> subdirectory for the PPD you are seeking.
852 <title>CUPS Also Uses PPDs for Non-PostScript Printers</title>
855 <indexterm><primary>non-PostScript</primary></indexterm>
856 <indexterm><primary>PPD</primary></indexterm>
857 <indexterm><primary>CUPS filtering</primary></indexterm>
858 CUPS also uses specially crafted PPDs to handle non-PostScript printers. These PPDs are usually not available
859 from the vendors (and no, you can't just take the PPD of a PostScript printer with the same model name and
860 hope it works for the non-PostScript version too). To understand how these PPDs work for non-PS printers, we
861 first need to dive deeply into the CUPS filtering and file format conversion architecture. Stay tuned.
869 <title>The CUPS Filtering Architecture</title>
872 <indexterm><primary>CUPS filtering</primary></indexterm>
873 <indexterm><primary>Ghostscript</primary></indexterm>
874 <indexterm><primary>MIME type</primary></indexterm>
875 <indexterm><primary>MIME recognition</primary></indexterm>
876 <indexterm><primary>MIME conversion rules</primary></indexterm>
877 The core of the CUPS filtering system is based on Ghostscript. In addition to Ghostscript, CUPS uses some
878 other filters of its own. You (or your OS vendor) may have plugged in even more filters. CUPS handles all data
879 file formats under the label of various MIME types. Every incoming print file is subjected to an initial
880 autotyping. The autotyping determines its given MIME type. A given MIME type implies zero or more possible
881 filtering chains relevant to the selected target printer. This section discusses how MIME types recognition
882 and conversion rules interact. They are used by CUPS to automatically set up a working filtering chain for any
883 given input data format.
887 If CUPS rasterizes a PostScript file natively to a bitmap, this is done in two stages:
892 <indexterm><primary>generic raster format</primary></indexterm>
893 <indexterm><primary>CUPS raster</primary></indexterm>
894 The first stage uses a Ghostscript device named <quote>cups</quote>
895 (this is since version 1.1.15) and produces a generic raster format
896 called <quote>CUPS raster</quote>.
900 <indexterm><primary>raster driver</primary></indexterm>
901 The second stage uses a <quote>raster driver</quote> that converts
902 the generic CUPS raster to a device-specific raster.
907 <indexterm><primary>Ghostscript</primary></indexterm>
908 <indexterm><primary>GNU Ghostscript</primary></indexterm>
909 <indexterm><primary>ESP Ghostscript</primary></indexterm>
910 Make sure your Ghostscript version has the <quote>cups</quote> device compiled in (check with <command>gs -h |
911 grep cups</command>). Otherwise you may encounter the dreaded <computeroutput>Unable to convert file
912 0</computeroutput> in your CUPS error_log file. To have <quote>cups</quote> as a device in your Ghostscript,
913 you either need to patch GNU Ghostscript and recompile or use
914 <indexterm><primary>ESP</primary><secondary>Ghostscript</secondary></indexterm><ulink
915 url="http://www.cups.org/ghostscript.php">ESP Ghostscript</ulink>. The superior alternative is ESP
916 Ghostscript. It supports not just CUPS, but 300 other devices (while GNU Ghostscript supports only about 180).
917 Because of this broad output device support, ESP Ghostscript is the first choice for non-CUPS spoolers, too.
918 It is now recommended by Linuxprinting.org for all spoolers.
922 <indexterm><primary>cupsomatic</primary></indexterm>
923 <indexterm><primary>foomatic</primary></indexterm>
924 <indexterm><primary>foomatic-rip</primary></indexterm>
925 <indexterm><primary>ESP Ghostscript</primary></indexterm>
926 CUPS printers may be set up to use external rendering paths. One of the most common is provided by the
927 Foomatic/cupsomatic concept from <ulink url="http://www.linuxprinting.org/">Linuxprinting.org</ulink>. This
928 uses the classical Ghostscript approach, doing everything in one step. It does not use the
929 <quote>cups</quote> device, but one of the many others. However, even for Foomatic/cupsomatic usage, best
930 results and <indexterm><primary>ESP</primary><secondary>Ghostscript</secondary></indexterm> broadest printer
931 model support is provided by ESP Ghostscript (more about Foomatic/cupsomatic, particularly the new version
932 called now <emphasis>foomatic-rip</emphasis>, follows).
936 <title>MIME Types and CUPS Filters</title>
940 <indexterm><primary>MIME</primary><secondary>filters</secondary></indexterm>
941 <indexterm><primary>MIME</primary></indexterm>
942 <indexterm><primary>mime.types</primary></indexterm>
943 <indexterm><primary>application/pdf</primary></indexterm>
944 <indexterm><primary>autotyping</primary></indexterm>
945 CUPS reads the file <filename>/etc/cups/mime.types</filename> (and all other files carrying a
946 <filename>*.types</filename> suffix in the same directory) upon startup. These files contain the MIME type
947 recognition rules that are applied when CUPS runs its autotyping routines. The rule syntax is explained in the
948 man page for <filename>mime.types</filename> and in the comments section of the
949 <filename>mime.types</filename> file itself. A simple rule reads like this:
950 <indexterm><primary>application/pdf</primary></indexterm>
952 application/pdf pdf string(0,%PDF)
954 <indexterm><primary>%PDF</primary></indexterm>
955 <indexterm><primary>.pdf</primary></indexterm>
956 This means if a filename has a <filename>.pdf</filename> suffix or if the magic string
957 <emphasis>%PDF</emphasis> is right at the beginning of the file itself (offset 0 from the start), then it is a
958 PDF file (<parameter>application/pdf</parameter>). Another rule is this:
960 application/postscript ai eps ps string(0,%!) string(0,<04>%!)
962 <indexterm><primary>suffixes</primary></indexterm>
963 <indexterm><primary>.ai</primary></indexterm>
964 <indexterm><primary>.eps</primary></indexterm>
965 <indexterm><primary>.ps</primary></indexterm>
966 <indexterm><primary>generic PostScript</primary></indexterm>
967 <indexterm><primary>application/postscript</primary></indexterm>
968 If the filename has one of the suffixes <filename>.ai</filename>, <filename>.eps</filename>,
969 <filename>.ps</filename>, or if the file itself starts with one of the strings <emphasis>%!</emphasis> or
970 <emphasis><![CDATA[<04>%!]]></emphasis>, it is a generic PostScript file
971 (<parameter>application/postscript</parameter>).
975 <indexterm><primary>/etc/cups/</primary></indexterm>
976 Don't confuse the other mime.types files your system might be using
977 with the one in the <filename>/etc/cups/</filename> directory.
981 <indexterm><primary>application/postscript</primary></indexterm>
982 <indexterm><primary>PostScript</primary></indexterm>
983 <indexterm><primary>filter</primary></indexterm>
984 <indexterm><primary>PPD</primary></indexterm>
985 <indexterm><primary>transformation</primary></indexterm>
986 There is an important difference between two similar MIME types in CUPS: one is
987 <parameter>application/postscript</parameter>, the other is
988 <parameter>application/vnd.cups-postscript</parameter>. While <parameter>application/postscript</parameter> is
989 meant to be device-independent, job options for the file are still outside the PS file content, embedded in
990 command line or environment variables by CUPS, <parameter>application/vnd.cups-postscript</parameter> may have
991 the job options inserted into the PostScript data itself (where applicable). The transformation of the generic
992 PostScript (<parameter>application/postscript</parameter>) to the device-specific version
993 (<parameter>application/vnd.cups-postscript</parameter>) is the responsibility of the CUPS
994 <parameter>pstops</parameter> filter. pstops uses information contained in the PPD to do the transformation.
998 <indexterm><primary>ASCII</primary></indexterm>
999 <indexterm><primary>HP-GL</primary></indexterm>
1000 <indexterm><primary>PDF</primary></indexterm>
1001 <indexterm><primary>PostScript</primary></indexterm>
1002 <indexterm><primary>DVI</primary></indexterm>
1003 <indexterm><primary>GIF</primary></indexterm>
1004 <indexterm><primary>PNG</primary></indexterm>
1005 <indexterm><primary>TIFF</primary></indexterm>
1006 <indexterm><primary>JPEG</primary></indexterm>
1007 <indexterm><primary>Photo-CD</primary></indexterm>
1008 <indexterm><primary>SUN-Raster</primary></indexterm>
1009 <indexterm><primary>PNM</primary></indexterm>
1010 <indexterm><primary>PBM</primary></indexterm>
1011 <indexterm><primary>SGI-RGB</primary></indexterm>
1012 <indexterm><primary>MIME</primary></indexterm>
1013 <indexterm><primary>filters</primary></indexterm>
1014 CUPS can handle ASCII text, HP-GL, PDF, PostScript, DVI, and
1015 many image formats (GIF, PNG, TIFF, JPEG, Photo-CD, SUN-Raster,
1016 PNM, PBM, SGI-RGB, and more) and their associated MIME types
1023 <title>MIME Type Conversion Rules</title>
1027 <indexterm><primary>MIME</primary></indexterm>
1028 <indexterm><primary>application/pdf</primary></indexterm>
1029 <indexterm><primary>/etc/cups/mime.convs</primary></indexterm>
1030 <indexterm><primary>application/pdf</primary></indexterm>
1031 <indexterm><primary>application/postscript</primary></indexterm>
1032 CUPS reads the file <filename>/etc/cups/mime.convs</filename>
1033 (and all other files named with a <filename>*.convs</filename>
1034 suffix in the same directory) upon startup. These files contain
1035 lines naming an input MIME type, an output MIME type, a format
1036 conversion filter that can produce the output from the input type,
1037 and virtual costs associated with this conversion. One example line
1040 application/pdf application/postscript 33 pdftops
1042 <indexterm><primary>pdftops</primary></indexterm>
1043 This means that the <parameter>pdftops</parameter> filter will take
1044 <parameter>application/pdf</parameter> as input and produce
1045 <parameter>application/postscript</parameter> as output; the virtual
1046 cost of this operation is 33 CUPS-$. The next filter is more
1047 expensive, costing 66 CUPS-$:
1048 <indexterm><primary>pdf</primary></indexterm>
1050 application/vnd.hp-HPGL application/postscript 66 hpgltops
1052 <indexterm><primary>hpgltops</primary></indexterm>
1053 This is the <parameter>hpgltops</parameter>, which processes HP-GL
1054 plotter files to PostScript.
1055 <indexterm><primary>application/octet-stream</primary></indexterm>
1057 application/octet-stream
1059 Here are two more examples:
1060 <indexterm><primary>text/plain</primary></indexterm>
1061 <indexterm><primary>application/x-shell</primary></indexterm>
1062 <indexterm><primary>text/plain</primary></indexterm>
1063 <indexterm><primary>texttops</primary></indexterm>
1065 application/x-shell application/postscript 33 texttops
1066 text/plain application/postscript 33 texttops
1068 <indexterm><primary>application/x-shell</primary></indexterm>
1069 The last two examples name the <parameter>texttops</parameter> filter to work on
1070 <parameter>text/plain</parameter> as well as on <parameter>application/x-shell</parameter>. (Hint: This
1071 differentiation is needed for the syntax highlighting feature of <parameter>texttops</parameter>).
1076 <title>Filtering Overview</title>
1079 <indexterm><primary>MIME</primary></indexterm>
1080 There are many more combinations named in <filename>mime.convs</filename>. However, you are not limited to use
1081 the ones predefined there. You can plug in any filter you like to the CUPS framework. It must meet, or must be
1082 made to meet, some minimal requirements. If you find (or write) a cool conversion filter of some kind, make
1083 sure it complies with what CUPS needs and put in the right lines in <filename>mime.types</filename> and
1084 <filename>mime.convs</filename>; then it will work seamlessly inside CUPS.
1088 <title>Filter Requirements</title>
1091 The <quote>CUPS requirements</quote> for filters are simple. Take filenames or <filename>stdin</filename> as
1092 input and write to <filename>stdout</filename>. They should take these arguments:
1096 <varlistentry><term>printer</term>
1098 The name of the printer queue (normally this is the name of the filter being run).
1102 <varlistentry><term>job</term>
1104 The numeric job ID for the job being printed.
1108 <varlistentry><term>user</term>
1110 The string from the originating-user-name attribute.
1114 <varlistentry><term>title</term>
1116 The string from the job-name attribute.
1120 <varlistentry><term>copies</term>
1122 The numeric value from the number-copies attribute.
1126 <varlistentry><term>options</term>
1132 <varlistentry><term>filename</term>
1134 (optionally) The print request file (if missing, filters expect data
1135 fed through <filename>stdin</filename>). In most cases, it is easy to
1136 write a simple wrapper script around existing filters to make them work with CUPS.
1146 <title>Prefilters</title>
1149 <indexterm><primary>PostScript</primary></indexterm>
1150 <indexterm><primary>non-PostScript printers</primary></indexterm>
1151 <indexterm><primary>raster</primary></indexterm>
1152 As previously stated, PostScript is the central file format to any UNIX-based
1153 printing system. From PostScript, CUPS generates raster data to feed
1154 non-PostScript printers.
1158 <indexterm><primary>prefilters</primary></indexterm>
1159 <indexterm><primary>PostScript</primary></indexterm>
1160 <indexterm><primary>ASCII text</primary></indexterm>
1161 <indexterm><primary>PDF</primary></indexterm>
1162 <indexterm><primary>DVI</primary></indexterm>
1163 <indexterm><primary>HP-GL.</primary></indexterm>
1164 <indexterm><primary>MIME type</primary></indexterm>
1165 <indexterm><primary>application/postscript</primary></indexterm>
1166 <indexterm><primary>pstops</primary></indexterm>
1167 <indexterm><primary>application/vnd.cups-postscript</primary></indexterm>
1168 But what happens if you send one of the supported non-PS formats to print? Then CUPS runs
1169 <quote>prefilters</quote> on these input formats to generate PostScript first. There are prefilters to create
1170 PostScript from ASCII text, PDF, DVI, or HP-GL. The outcome of these filters is always of MIME type
1171 <parameter>application/postscript</parameter> (meaning that any device-specific print options are not yet
1172 embedded into the PostScript by CUPS and that the next filter to be called is pstops). Another prefilter is
1173 running on all supported image formats, the <parameter>imagetops</parameter> filter. Its outcome is always of
1174 MIME type <parameter>application/vnd.cups-postscript</parameter> (not application/postscript), meaning it has
1175 the print options already embedded into the file. This is shown in <link linkend="f4small">Prefiltering in
1176 CUPS to Form PostScript</link>.
1179 <figure id="f4small">
1180 <title>Prefiltering in CUPS to Form PostScript.</title>
1181 <imagefile scale="25">4small</imagefile>
1187 <title>pstops</title>
1190 <indexterm><primary>pstops</primary></indexterm>
1191 <indexterm><primary>application/postscript</primary></indexterm>
1192 <indexterm><primary>application/vnd.cups-postscript</primary></indexterm>
1193 <indexterm><primary>output duplexing</primary></indexterm>
1194 <indexterm><primary>stapling</primary></indexterm>
1195 <indexterm><primary>punching</primary></indexterm>
1196 <indexterm><primary>PostScript</primary></indexterm>
1197 <emphasis>pstops</emphasis> is a filter that is used to convert <parameter>application/postscript</parameter> to
1198 <parameter>application/vnd.cups-postscript</parameter>. As stated earlier, this filter inserts all
1199 device-specific print options (commands to the printer to ask for the duplexing of output, or stapling and
1200 punching it, and so on) into the PostScript file. An example is illustrated in <link
1201 linkend="f5small">Adding Device-Specific Print Options</link>.
1204 <figure id="f5small">
1205 <title>Adding Device-Specific Print Options.</title>
1206 <imagefile scale="25">5small</imagefile>
1210 This is not all. Other tasks performed by it are:
1215 Selecting the range of pages to be printed (e.g., you can choose to
1216 print only pages <quote>3, 6, 8-11, 16, and 19-21</quote>, or only odd-numbered
1221 Putting two or more logical pages on one sheet of paper (the
1222 so-called <quote>number-up</quote> function).
1225 <listitem><para>Counting the pages of the job to insert the accounting
1226 information into the <filename>/var/log/cups/page_log</filename>.
1232 <title>pstoraster</title>
1235 <indexterm><primary>pstoraster</primary></indexterm>
1236 <indexterm><primary>rasterization</primary></indexterm>
1237 <indexterm><primary>raster drivers</primary></indexterm>
1238 <parameter>pstoraster</parameter> is at the core of the CUPS filtering system. It is responsible for the first
1239 stage of the rasterization process. Its input is of MIME type application/vnd.cups-postscript; its output is
1240 application/vnd.cups-raster. This output format is not yet meant to be printable. Its aim is to serve as a
1241 general-purpose input format for more specialized <emphasis>raster drivers</emphasis> that are able to
1242 generate device-specific printer data. This is shown in <link linkend="cups-raster">the PostScript to
1243 Intermediate Raster Format diagram</link>.
1246 <figure id="cups-raster">
1247 <title>PostScript to Intermediate Raster Format.</title>
1248 <imagefile scale="25">6small</imagefile>
1252 <indexterm><primary>CUPS raster</primary></indexterm>
1253 <indexterm><primary>generic raster</primary></indexterm>
1254 <indexterm><primary>IANA</primary></indexterm>
1255 <indexterm><primary>raster drivers</primary></indexterm>
1256 CUPS raster is a generic raster format with powerful features. It is able to include per-page information,
1257 color profiles, and more, to be used by the downstream raster drivers. Its MIME type is registered with IANA
1258 and its specification is, of course, completely open. It is designed to make it quite easy and inexpensive for
1259 manufacturers to develop Linux and UNIX raster drivers for their printer models should they choose to do so.
1260 CUPS always takes care of the first stage of rasterization so these vendors do not need to care about
1261 Ghostscript complications (in fact, there are currently more than one vendor financing the development of CUPS
1262 raster drivers). This is illustrated in <link linkend="cups-raster2">the CUPS-Raster Production Using
1263 Ghostscript illustration</link>.
1266 <figure id="cups-raster2">
1267 <title>CUPS-Raster Production Using Ghostscript.</title>
1268 <imagefile>7small</imagefile>
1272 <indexterm><primary>pstoraster</primary></indexterm>
1273 <indexterm><primary>GNU Ghostscript</primary></indexterm>
1274 <indexterm><primary>AFPL Ghostscript</primary></indexterm>
1275 <indexterm><primary>standalone filter</primary></indexterm>
1276 CUPS versions before version 1.1.15 shipped a binary (or source code) standalone filter, named
1277 <parameter>pstoraster</parameter>. <parameter>pstoraster</parameter>, which was derived from GNU Ghostscript
1278 5.50 and could be installed instead of and in addition to any GNU or AFPL Ghostscript package without
1283 Since version 1.1.15, this feature has changed. The functions for this filter have been integrated back
1284 into Ghostscript (now based on GNU Ghostscript version 7.05). The <parameter>pstoraster</parameter> filter is
1285 now a simple shell script calling <command>gs</command> with the <command>-sDEVICE=cups</command> parameter.
1286 If your Ghostscript fails when this command is executed: <command>gs -h |grep cups</command>, you might not
1287 be able to print, update your Ghostscript.
1292 <title>imagetops and imagetoraster</title>
1295 <indexterm><primary>prefilter</primary></indexterm>
1296 <indexterm><primary>imagetoraster</primary></indexterm>
1297 In the section about prefilters, we mentioned the prefilter
1298 that generates PostScript from image formats. The <parameter>imagetoraster</parameter>
1299 filter is used to convert directly from image to raster, without the
1300 intermediate PostScript stage. It is used more often than the previously
1301 mentioned prefilters. We summarize in a flowchart the image file
1302 filtering in <link linkend="small8">the Image Format to CUPS-Raster Format Conversion illustration</link>.
1305 <figure id="small8">
1306 <title>Image Format to CUPS-Raster Format Conversion.</title>
1307 <imagefile>8small</imagefile>
1313 <title>rasterto [printers specific]</title>
1316 <indexterm><primary>rastertoalps</primary></indexterm>
1317 <indexterm><primary>rastertobj</primary></indexterm>
1318 <indexterm><primary>rastertoepson</primary></indexterm>
1319 <indexterm><primary>rastertoescp</primary></indexterm>
1320 <indexterm><primary>rastertopcl</primary></indexterm>
1321 <indexterm><primary>rastertoturboprint</primary></indexterm>
1322 <indexterm><primary>rastertoescp</primary></indexterm>
1323 <indexterm><primary>rastertohp</primary></indexterm>
1324 <indexterm><primary>rastertoprinter</primary></indexterm>
1325 <indexterm><primary>rastertoprinter</primary></indexterm>
1326 <indexterm><primary>Gutenprint</primary></indexterm>
1327 CUPS ships with quite a variety of raster drivers for processing CUPS raster. On my system, I find in
1328 /usr/lib/cups/filter/ the following: <parameter>rastertoalps</parameter>, <parameter>rastertobj</parameter>,
1329 <parameter>rastertoepson</parameter>, <parameter>rastertoescp</parameter>, <parameter>rastertopcl</parameter>,
1330 <parameter>rastertoturboprint</parameter>, <parameter>rastertoapdk</parameter>,
1331 <parameter>rastertodymo</parameter>, <parameter>rastertoescp</parameter>, <parameter>rastertohp</parameter>,
1332 and <parameter>rastertoprinter</parameter>. Don't worry if you have fewer drivers than this; some of these are
1333 installed by commercial add-ons to CUPS (like <parameter>rastertoturboprint</parameter>), and others (like
1334 <parameter>rastertoprinter</parameter>) by third-party driver development projects (such as Gutenprint)
1335 wanting to cooperate as closely as possible with CUPS. See <link linkend="small9">the Raster to
1336 Printer-Specific Formats illustration</link>.
1339 <figure id="small9">
1340 <title>Raster to Printer-Specific Formats.</title>
1341 <imagefile>9small</imagefile>
1346 <title>CUPS Backends</title>
1349 <indexterm><primary>CUPS filtering chain</primary></indexterm>
1350 <indexterm><primary>print queue</primary></indexterm>
1351 The last part of any CUPS filtering chain is a backend. Backends
1352 are special programs that send the print-ready file to the final
1353 device. There is a separate backend program for any transfer
1354 protocol for sending print jobs over the network, and one for every local
1355 interface. Every CUPS print queue needs to have a CUPS <quote>device-URI</quote>
1356 associated with it. The device URI is the way to encode the backend
1357 used to send the job to its destination. Network device-URIs use
1358 two slashes in their syntax, local device URIs only one, as you can
1359 see from the following list. Keep in mind that local interface names
1360 may vary greatly from my examples, if your OS is not Linux:
1364 <varlistentry><term>usb</term>
1366 This backend sends print files to USB-connected printers. An
1367 example for the CUPS device-URI to use is
1368 <filename>usb:/dev/usb/lp0</filename>.
1369 </para></listitem></varlistentry>
1371 <varlistentry><term>serial</term>
1373 This backend sends print files to serially connected printers.
1374 An example for the CUPS device-URI to use is
1375 <filename>serial:/dev/ttyS0?baud=11500</filename>.
1376 </para></listitem></varlistentry>
1378 <varlistentry><term>parallel</term>
1380 This backend sends print files to printers connected to the
1381 parallel port. An example for the CUPS device-URI to use is
1382 <filename>parallel:/dev/lp0</filename>.
1383 </para></listitem></varlistentry>
1385 <varlistentry><term>SCSI</term>
1387 This backend sends print files to printers attached to the
1388 SCSI interface. An example for the CUPS device-URI to use is
1389 <filename>scsi:/dev/sr1</filename>.
1390 </para></listitem></varlistentry>
1392 <varlistentry><term>lpd</term>
1394 This backend sends print files to LPR/LPD-connected network
1395 printers. An example for the CUPS device-URI to use is
1396 <filename>lpd://remote_host_name/remote_queue_name</filename>.
1397 </para></listitem></varlistentry>
1399 <varlistentry><term>AppSocket/HP JetDirect</term>
1401 This backend sends print files to AppSocket (a.k.a., HP
1402 JetDirect) connected network printers. An example for the CUPS
1403 device-URI to use is
1404 <filename>socket://10.11.12.13:9100</filename>.
1405 </para></listitem></varlistentry>
1407 <varlistentry><term>ipp</term>
1409 This backend sends print files to IPP-connected network
1410 printers (or to other CUPS servers). Examples for CUPS device-URIs
1412 <filename>ipp:://192.193.194.195/ipp</filename>
1413 (for many HP printers) and
1414 <filename>ipp://remote_cups_server/printers/remote_printer_name</filename>.
1415 </para></listitem></varlistentry>
1417 <varlistentry><term>http</term>
1419 This backend sends print files to HTTP-connected printers.
1420 (The http:// CUPS backend is only a symlink to the ipp:// backend.)
1421 Examples for the CUPS device-URIs to use are
1422 <filename>http:://192.193.194.195:631/ipp</filename>
1423 (for many HP printers) and
1424 <filename>http://remote_cups_server:631/printers/remote_printer_name</filename>.
1425 </para></listitem></varlistentry>
1427 <varlistentry><term>smb</term>
1429 This backend sends print files to printers shared by a Windows
1430 host. Examples of CUPS device-URIs that may be used includes:
1435 <member><filename>smb://workgroup/server/printersharename</filename></member>
1436 <member><filename>smb://server/printersharename</filename></member>
1437 <member><filename>smb://username:password@workgroup/server/printersharename</filename></member>
1438 <member><filename>smb://username:password@server/printersharename</filename></member>
1443 The smb:// backend is a symlink to the Samba utility
1444 <parameter>smbspool</parameter> (does not ship with CUPS). If the
1445 symlink is not present in your CUPS backend directory, have your
1446 root user create it: <command>ln -s `which smbspool'
1447 /usr/lib/cups/backend/smb</command>.
1448 </para></listitem></varlistentry>
1452 It is easy to write your own backends as shell or Perl scripts if you
1453 need any modification or extension to the CUPS print system. One
1454 reason could be that you want to create <quote>special</quote> printers that send
1455 the print jobs as email (through a <quote>mailto:/</quote> backend), convert them to
1456 PDF (through a <quote>pdfgen:/</quote> backend) or dump them to <quote>/dev/null</quote>. (In
1457 fact, I have the systemwide default printer set up to be connected to
1458 a devnull:/ backend: there are just too many people sending jobs
1459 without specifying a printer, and scripts and programs that do not name
1460 a printer. The systemwide default deletes the job and sends a polite
1461 email back to the $USER asking him or her to always specify the correct
1466 <indexterm><primary>lpinfo</primary></indexterm>
1467 <indexterm><primary>CUPS backends</primary></indexterm>
1468 Not all of the mentioned backends may be present on your system or
1469 usable (depending on your hardware configuration). One test for all
1470 available CUPS backends is provided by the <emphasis>lpinfo</emphasis>
1471 utility. Used with the <option>-v</option> parameter, it lists
1472 all available backends:
1476 &prompt;<userinput>lpinfo -v</userinput>
1481 <title>The Role of <parameter>cupsomatic/foomatic</parameter></title>
1484 <indexterm><primary>cupsomatic</primary></indexterm>
1485 <indexterm><primary>foomatic</primary></indexterm>
1486 <indexterm><primary>PPDs</primary></indexterm>
1487 <indexterm><primary>Foomatic Printer</primary></indexterm>
1488 <indexterm><primary>Linuxprinting.org</primary></indexterm>
1489 <parameter>cupsomatic</parameter> filters may be the most widely used on CUPS
1490 installations. You must be clear that these were not
1491 developed by the CUPS people. They are a third-party add-on to
1492 CUPS. They utilize the traditional Ghostscript devices to render jobs
1493 for CUPS. When troubleshooting, you should know about the
1494 difference. Here the whole rendering process is done in one stage,
1495 inside Ghostscript, using an appropriate device for the target
1496 printer. <parameter>cupsomatic</parameter> uses PPDs that are generated from the Foomatic
1497 Printer & Driver Database at Linuxprinting.org.
1501 You can recognize these PPDs from the line calling the
1502 <parameter>cupsomatic</parameter> filter:
1504 *cupsFilter: "application/vnd.cups-postscript 0 cupsomatic"
1506 You may find this line among the first 40 or so lines of the PPD
1507 file. If you have such a PPD installed, the printer shows up in the
1508 CUPS Web interface with a <parameter>foomatic</parameter> namepart for
1509 the driver description. <parameter>cupsomatic</parameter> is a Perl script that runs
1510 Ghostscript with all the complicated command line options
1511 autoconstructed from the selected PPD and command line options given to
1516 <indexterm><primary>point'n'print</primary></indexterm>
1517 <indexterm><primary>foomatic-rip</primary></indexterm>
1518 <indexterm><primary>Adobe specifications</primary></indexterm>
1519 <indexterm><primary>hi-res photo</primary></indexterm>
1520 <indexterm><primary>normal color</primary></indexterm>
1521 <indexterm><primary>grayscale</primary></indexterm>
1522 <indexterm><primary>draft</primary></indexterm>
1523 <indexterm><primary>media type</primary></indexterm>
1524 <indexterm><primary>resolution</primary></indexterm>
1525 <indexterm><primary>inktype</primary></indexterm>
1526 <indexterm><primary>dithering algorithm</primary></indexterm>
1527 However, <parameter>cupsomatic</parameter> is now deprecated. Its PPDs (especially the first
1528 generation of them, still in heavy use out there) are not meeting the
1529 Adobe specifications. You might also suffer difficulties when you try
1530 to download them with <quote>Point'n'Print</quote> to Windows clients. A better
1531 and more powerful successor is now available: it is called <parameter>foomatic-rip</parameter>. To use
1532 <parameter>foomatic-rip</parameter> as a filter with CUPS, you need the new type of PPDs, which
1533 have a similar but different line:
1535 *cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
1537 The PPD-generating engine at Linuxprinting.org has been revamped.
1538 The new PPDs comply with the Adobe spec. They also provide a
1539 new way to specify different quality levels (hi-res photo, normal
1540 color, grayscale, and draft) with a single click, whereas before you
1541 could have required five or more different selections (media type,
1542 resolution, inktype, and dithering algorithm). There is support for
1543 custom-size media built in. There is support to switch
1544 print options from page to page in the middle of a job. And the
1545 best thing is that the new <constant>foomatic-rip</constant> works seamlessly with all
1546 legacy spoolers too (like LPRng, BSD-LPD, PDQ, PPR, and so on), providing
1547 for them access to use PPDs for their printing.
1552 <title>The Complete Picture</title>
1555 If you want to see an overview of all the filters and how they
1556 relate to each other, the complete picture of the puzzle is at the end
1562 <title><filename>mime.convs</filename></title>
1565 CUPS autoconstructs all possible filtering chain paths for any given
1566 MIME type and every printer installed. But how does it decide in
1567 favor of or against a specific alternative? (There may be cases
1568 where there is a choice of two or more possible filtering chains for
1569 the same target printer.) Simple. You may have noticed the figures in
1570 the third column of the mime.convs file. They represent virtual costs
1571 assigned to this filter. Every possible filtering chain will sum up to
1572 a total <quote>filter cost.</quote> CUPS decides for the most <quote>inexpensive</quote> route.
1576 <indexterm><primary>cupsd.conf</primary></indexterm>
1577 <indexterm><primary>FilterLimit</primary></indexterm>
1578 Setting <parameter>FilterLimit 1000</parameter> in
1579 <filename>cupsd.conf</filename> will not allow more filters to
1580 run concurrently than will consume a total of 1000 virtual filter
1581 cost. This is an efficient way to limit the load of any CUPS
1582 server by setting an appropriate <quote>FilterLimit</quote> value. A FilterLimit of
1583 200 allows roughly one job at a time, while a FilterLimit of 1000 allows
1584 approximately five jobs maximum at a time.
1589 <title><quote>Raw</quote> Printing</title>
1592 <indexterm><primary>PPD</primary></indexterm>
1593 <indexterm><primary>lpadmin</primary></indexterm>
1594 <indexterm><primary>rawprinter</primary></indexterm>
1595 You can tell CUPS to print (nearly) any file <quote>raw</quote>. <quote>Raw</quote> means it will not be
1596 filtered. CUPS will send the file to the printer <quote>as is</quote> without bothering if the printer is able
1597 to digest it. Users need to take care themselves that they send sensible data formats only. Raw printing can
1598 happen on any queue if the <quote><parameter>-o raw</parameter></quote> option is specified on the command
1599 line. You can also set up raw-only queues by simply not associating any PPD with it. This command:
1601 &prompt;<userinput>lpadmin -P rawprinter -v socket://11.12.13.14:9100 -E</userinput>
1603 sets up a queue named <quote>rawprinter</quote>, connected via the <quote>socket</quote> protocol (a.k.a.
1604 <quote>HP JetDirect</quote>) to the device at IP address 11.12.1.3.14, using port 9100. (If you had added a
1605 PPD with <command>-P /path/to/PPD</command> to this command line, you would have installed a
1606 <quote>normal</quote> print queue.)
1610 CUPS will automatically treat each job sent to a queue as a <quote>raw</quote> one
1611 if it can't find a PPD associated with the queue. However, CUPS will
1612 only send known MIME types (as defined in its own mime.types file) and
1618 <title>application/octet-stream Printing</title>
1621 <indexterm><primary>/etc/cups/mime.types</primary></indexterm>
1622 <indexterm><primary>application/octet-stream</primary></indexterm>
1623 Any MIME type with no rule in the <filename>/etc/cups/mime.types</filename> file is regarded as unknown
1624 or <parameter>application/octet-stream</parameter> and will not be
1625 sent. Because CUPS refuses to print unknown MIME types by default,
1626 you will probably have experienced that print jobs originating
1627 from Windows clients were not printed. You may have found an error
1628 message in your CUPS logs like:
1631 <para><computeroutput>
1632 Unable to convert file 0 to printable format for job
1633 </computeroutput></para>
1636 To enable the printing of <parameter>application/octet-stream</parameter> files, edit
1641 <listitem><para><filename>/etc/cups/mime.convs</filename></para></listitem>
1643 <listitem><para><filename>/etc/cups/mime.types</filename></para></listitem>
1647 <indexterm><primary>raw mode</primary></indexterm>
1648 Both contain entries (at the end of the respective files) that must be uncommented to allow raw mode
1649 operation for <parameter>application/octet-stream</parameter>. In <filename>/etc/cups/mime.types</filename>
1650 make sure this line is present:
1651 <indexterm><primary>application/octet-stream</primary></indexterm>
1653 application/octet-stream
1655 This line (with no specific autotyping rule set) makes all files
1656 not otherwise auto-typed a member of <parameter>application/octet-stream</parameter>. In
1657 <filename>/etc/cups/mime.convs</filename>, have this
1660 application/octet-stream application/vnd.cups-raw 0 -
1662 <indexterm><primary>MIME</primary></indexterm>
1663 This line tells CUPS to use the <emphasis>Null Filter</emphasis>
1664 (denoted as <quote>-</quote>, doing nothing at all) on
1665 <parameter>application/octet-stream</parameter>, and tag the result as
1666 <parameter>application/vnd.cups-raw</parameter>. This last one is
1667 always a green light to the CUPS scheduler to now hand the file over
1668 to the backend connecting to the printer and sending it over.
1672 Editing the <filename>mime.convs</filename> and the <filename>mime.types</filename> file does not
1673 <emphasis>enforce</emphasis> <quote>raw</quote> printing, it only <emphasis>allows</emphasis> it.
1677 <title>Background</title>
1680 <indexterm><primary>security-aware</primary></indexterm>
1681 <indexterm><primary>MIME type</primary></indexterm>
1682 <indexterm><primary>/etc/cups/mime.types</primary></indexterm>
1683 <indexterm><primary>/etc/cups/mime.convs</primary></indexterm>
1684 That CUPS is a more security-aware printing system than traditional ones
1685 does not by default allow one to send deliberate (possibly binary)
1686 data to printing devices. (This could be easily abused to launch a
1687 Denial of Service attack on your printer(s), causing at least the loss
1688 of a lot of paper and ink.) <quote>Unknown</quote> data are regarded by CUPS
1689 as <emphasis>MIME type</emphasis> <emphasis>application/octet-stream</emphasis>. While you
1690 <emphasis>can</emphasis> send data <quote>raw</quote>, the MIME type for these must
1691 be one that is known to CUPS and allowed by it. The file
1692 <filename>/etc/cups/mime.types</filename> defines the <quote>rules</quote> of how CUPS
1693 recognizes MIME types. The file <filename>/etc/cups/mime.convs</filename> decides which file
1694 conversion filter(s) may be applied to which MIME types.
1700 <title>PostScript Printer Descriptions for Non-PostScript Printers</title>
1703 <indexterm><primary>PPD</primary></indexterm>
1704 <indexterm><primary>non-PostScript</primary></indexterm>
1705 <indexterm><primary>PostScript</primary></indexterm>
1706 <indexterm><primary>RIP</primary></indexterm>
1707 <indexterm><primary>Ghostscript</primary></indexterm>
1708 <indexterm><primary>device-specific commands</primary></indexterm>
1709 Originally PPDs were meant to be used for PostScript printers
1710 only. Here, they help to send device-specific commands and settings
1711 to the RIP, which processes the job file. CUPS has extended this
1712 scope for PPDs to cover non-PostScript printers too. This was not
1713 difficult, because it is a standardized file format. In a way
1714 it was logical too: CUPS handles PostScript and uses a PostScript
1715 RIP (Ghostscript) to process the job files. The only difference is that
1716 a PostScript printer has the RIP built-in, for other types of
1717 printers the Ghostscript RIP runs on the host computer.
1721 PPDs for a non-PostScript printer have a few lines that are unique to
1722 CUPS. The most important one looks similar to this:
1723 <indexterm><primary>application/vnd.cups-raster</primary></indexterm>
1725 *cupsFilter: application/vnd.cups-raster 66 rastertoprinter
1727 It is the last piece in the CUPS filtering puzzle. This line tells the
1728 CUPS daemon to use as a last filter <parameter>rastertoprinter</parameter>. This filter
1729 should be served as input an <parameter>application/vnd.cups-raster</parameter> MIME type
1730 file. Therefore, CUPS should autoconstruct a filtering chain, which
1731 delivers as its last output the specified MIME type. This is then
1732 taken as input to the specified <parameter>rastertoprinter</parameter> filter. After
1733 the last filter has done its work (<parameter>rastertoprinter</parameter> is a Gutenprint
1734 filter), the file should go to the backend, which sends it to the
1739 CUPS by default ships only a few generic PPDs, but they are good for
1740 several hundred printer models. You may not be able to control
1741 different paper trays, or you may get larger margins than your
1742 specific model supports. See Table 21.1<link linkend="cups-ppds"></link> for summary information.
1745 <table frame="all" id="cups-ppds">
1746 <title>PPDs Shipped with CUPS</title>
1747 <tgroup cols="2" align="left">
1748 <colspec align="left"/>
1749 <colspec align="justify" colwidth="1*"/>
1750 <thead><row><entry>PPD file</entry><entry>Printer type</entry></row></thead>
1752 <row><entry>deskjet.ppd</entry><entry>older HP inkjet printers and compatible</entry></row>
1754 <row><entry>deskjet2.ppd</entry> <entry>newer HP inkjet printers and compatible </entry> </row>
1756 <row><entry>dymo.ppd</entry> <entry>label printers </entry> </row>
1758 <row><entry>epson9.ppd</entry> <entry>Epson 24-pin impact printers and compatible </entry> </row>
1760 <row><entry>epson24.ppd</entry> <entry>Epson 24-pin impact printers and compatible </entry> </row>
1762 <row><entry>okidata9.ppd</entry> <entry>Okidata 9-pin impact printers and compatible </entry> </row>
1764 <row><entry>okidat24.ppd</entry> <entry>Okidata 24-pin impact printers and compatible </entry> </row>
1766 <row><entry>stcolor.ppd</entry> <entry>older Epson Stylus Color printers </entry> </row>
1768 <row><entry>stcolor2.ppd</entry> <entry>newer Epson Stylus Color printers </entry> </row>
1770 <row><entry>stphoto.ppd</entry> <entry>older Epson Stylus Photo printers </entry> </row>
1772 <row><entry>stphoto2.ppd</entry> <entry>newer Epson Stylus Photo printers </entry> </row>
1774 <row><entry>laserjet.ppd</entry> <entry>all PCL printers </entry> </row>
1783 <title><emphasis>cupsomatic/foomatic-rip</emphasis> Versus <emphasis>Native CUPS</emphasis> Printing</title>
1786 <indexterm><primary>cupsomatic</primary></indexterm>
1787 <indexterm><primary>foomatic-rip</primary></indexterm>
1788 Native CUPS rasterization works in two steps:
1793 <indexterm><primary>pstoraster</primary></indexterm>
1794 First is the <parameter>pstoraster</parameter> step. It uses the special CUPS
1795 <indexterm><primary>ESP</primary><secondary>Ghostscript</secondary></indexterm>
1796 device from ESP Ghostscript 7.05.x as its tool.
1800 Second is the <parameter>rasterdriver</parameter> step. It uses various
1801 device-specific filters; there are several vendors who provide good
1802 quality filters for this step. Some are free software, some are
1803 shareware, and some are proprietary.
1808 Often this produces better quality (and has several more advantages) than other methods.
1809 This is shown in <link linkend="cupsomatic-dia"> the cupsomatic/foomatic Processing Versus Native CUPS
1810 illustration</link>.
1813 <figure id="cupsomatic-dia">
1814 <title>cupsomatic/foomatic Processing Versus Native CUPS.</title>
1815 <imagefile>10small</imagefile>
1819 One other method is the <parameter>cupsomatic/foomatic-rip</parameter>
1820 way. Note that <parameter>cupsomatic</parameter> is <emphasis>not</emphasis> made by the CUPS
1821 developers. It is an independent contribution to printing development,
1822 made by people from Linuxprinting.org.<footnote><para>See also <ulink
1823 noescape="1" url="http://www.cups.org/cups-help.html">http://www.cups.org/cups-help.html</ulink></para></footnote>
1824 <parameter>cupsomatic</parameter> is no longer developed, maintained, or supported. It now been
1825 replaced by <parameter>foomatic-rip</parameter>. <parameter>foomatic-rip</parameter> is a complete rewrite
1826 of the old <parameter>cupsomatic</parameter> idea, but very much improved and generalized to
1827 other (non-CUPS) spoolers. An upgrade to <parameter>foomatic-rip</parameter> is strongly
1828 advised, especially if you are upgrading to a recent version of CUPS,
1833 <indexterm><primary>cupsomatic</primary></indexterm>
1834 <indexterm><primary>foomatic</primary></indexterm>
1835 Like the old <parameter>cupsomatic</parameter> method, the <parameter>foomatic-rip</parameter> (new) method
1836 from Linuxprinting.org uses the traditional Ghostscript print file processing, doing everything in a single
1837 step. It therefore relies on all the other devices built into Ghostscript. The quality is as good (or bad) as
1838 Ghostscript rendering is in other spoolers. The advantage is that this method supports many printer models not
1839 supported (yet) by the more modern CUPS method.
1843 Of course, you can use both methods side by side on one system (and even for one printer, if you set up
1844 different queues) and find out which works best for you.
1848 <indexterm><primary>cupsomatic</primary></indexterm>
1849 <indexterm><primary>pstoraster</primary></indexterm>
1850 <indexterm><primary>rastertosomething</primary></indexterm>
1851 <indexterm><primary>rasterization</primary></indexterm>
1852 <indexterm><primary>Foomatic/cupsomatic</primary></indexterm>
1853 <indexterm><primary>rendering</primary></indexterm>
1854 <parameter>cupsomatic</parameter> kidnaps the print file after the
1855 <parameter>application/vnd.cups-postscript</parameter> stage and deviates it through the CUPS-external,
1856 systemwide Ghostscript installation. Therefore, the print file bypasses the <parameter>pstoraster</parameter>
1857 filter (and also bypasses the CUPS raster drivers <parameter>rastertosomething</parameter>). After Ghostscript
1858 finished its rasterization, <parameter>cupsomatic</parameter> hands the rendered file directly to the CUPS
1859 backend. <link linkend="cupsomatic-dia">cupsomatic/foomatic Processing Versus Native
1860 CUPS</link>, illustrates the difference between native CUPS rendering and the
1861 <parameter>Foomatic/cupsomatic</parameter> method.
1866 <title>Examples for Filtering Chains</title>
1869 Here are a few examples of commonly occurring filtering chains to
1870 illustrate the workings of CUPS.
1874 <indexterm><primary>HP JetDirect</primary></indexterm>
1875 <indexterm><primary>PostScript</primary></indexterm>
1876 <indexterm><primary>two-up</primary></indexterm>
1877 <indexterm><primary>duplex</primary></indexterm>
1878 Assume you want to print a PDF file to an HP JetDirect-connected
1879 PostScript printer, but you want to print pages 3-5, 7, and 11-13
1880 only, and you want to print them <quote>two-up</quote> and <quote>duplex</quote>:
1884 <listitem><para>Your print options (page selection as required, two-up,
1885 duplex) are passed to CUPS on the command line.</para></listitem>
1887 <listitem><para>The (complete) PDF file is sent to CUPS and autotyped as
1888 <parameter>application/pdf</parameter>.</para></listitem>
1890 <listitem><para>The file therefore must first pass the
1891 <parameter>pdftops</parameter> prefilter, which produces PostScript
1892 MIME type <parameter>application/postscript</parameter> (a preview here
1893 would still show all pages of the original PDF).</para></listitem>
1895 <listitem><para>The file then passes the <parameter>pstops</parameter>
1896 filter that applies the command line options: it selects pages
1897 2-5, 7, and 11-13, creates the imposed layout <quote>two pages on one sheet</quote>, and
1898 inserts the correct <quote>duplex</quote> command (as defined in the printer's
1899 PPD) into the new PostScript file; the file is now of PostScript MIME
1901 <parameter>application/vnd.cups-postscript</parameter>.</para></listitem>
1903 <listitem><para>The file goes to the <parameter>socket</parameter>
1904 backend, which transfers the job to the printers.</para></listitem>
1908 The resulting filter chain, therefore, is as shown in <link linkend="pdftosocket">the PDF to socket chain
1909 illustration</link>.
1912 <indexterm><primary>pdftosocket</primary></indexterm>
1913 <figure id="pdftosocket">
1914 <title>PDF to Socket Chain.</title>
1915 <imagefile>pdftosocket</imagefile>
1919 <indexterm><primary>USB</primary></indexterm>
1920 <indexterm><primary>Epson Stylus</primary></indexterm>
1921 <indexterm><primary>stphoto2.ppd</primary></indexterm>
1922 Assume you want to print the same filter to an USB-connected Epson Stylus Photo Printer installed with the CUPS
1923 <filename>stphoto2.ppd</filename>. The first few filtering stages are nearly the same:
1928 Your print options (page selection as required, two-up,
1929 duplex) are passed to CUPS on the command line.
1933 The (complete) PDF file is sent to CUPS and autotyped as
1934 <parameter>application/pdf</parameter>.
1938 <indexterm><primary>pdftops</primary></indexterm>
1939 <indexterm><primary>PDF</primary></indexterm>
1940 The file must first pass the <parameter>pdftops</parameter> prefilter, which produces PostScript
1941 MIME type <parameter>application/postscript</parameter> (a preview here would still show all
1942 pages of the original PDF).
1946 <indexterm><primary>pstops</primary></indexterm>
1947 <indexterm><primary>duplex printing</primary></indexterm>
1948 The file then passes the <quote>pstops</quote> filter that applies
1949 the command line options: it selects the pages 2-5, 7, and 11-13,
1950 creates the imposed layout <quote>two pages on one sheet,</quote> and inserts the
1951 correct <quote>duplex</quote> command (oops &smbmdash; this printer and PPD
1952 do not support duplex printing at all, so this option will
1953 be ignored) into the new PostScript file; the file is now of PostScript
1954 MIME type <parameter>application/vnd.cups-postscript</parameter>.
1958 The file then passes the <parameter>pstoraster</parameter> stage and becomes MIME type
1959 <parameter>application/cups-raster</parameter>.
1963 <indexterm><primary>rastertoepson</primary></indexterm>
1964 Finally, the <parameter>rastertoepson</parameter> filter
1965 does its work (as indicated in the printer's PPD), creating the
1966 printer-specific raster data and embedding any user-selected
1967 print options into the print data stream.
1971 The file goes to the <parameter>usb</parameter> backend, which transfers the job to the printers.
1976 The resulting filter chain therefore is as shown in <link linkend="pdftoepsonusb">the PDF to USB Chain
1977 illustration</link>.
1980 <figure id="pdftoepsonusb">
1981 <title>PDF to USB Chain.</title>
1982 <imagefile>pdftoepsonusb</imagefile>
1987 <title>Sources of CUPS Drivers/PPDs</title>
1990 On the Internet you can now find many thousands of CUPS-PPD files
1991 (with their companion filters), in many national languages
1992 supporting more than 1,000 non-PostScript models.
1996 <indexterm><primary>ESP</primary><secondary>Print Pro</secondary></indexterm>
1997 <indexterm><primary>PrintPro</primary><see>ESP Print Pro</see></indexterm>
1999 <ulink url="http://www.easysw.com/printpro/">ESP PrintPro</ulink>
2000 (commercial, non-free) is packaged with more than 3,000 PPDs, ready for
2001 successful use <quote>out of the box</quote> on Linux, Mac OS X, IBM-AIX,
2002 HP-UX, Sun-Solaris, SGI-IRIX, Compaq Tru64, Digital UNIX, and
2003 other commercial Unices (it is written by the CUPS developers
2004 themselves and its sales help finance the further development of
2005 CUPS, as they feed their creators).
2009 The <ulink url="http://gimp-print.sourceforge.net/">Gutenprint Project</ulink>
2010 (GPL, free software) provides around 140 PPDs (supporting nearly 400 printers, many driven
2011 to photo quality output), to be used alongside the Gutenprint CUPS filters.
2015 <ulink url="http://www.turboprint.de/english.html/">TurboPrint </ulink> (shareware, non-free) supports
2016 roughly the same number of printers in excellent quality.
2020 <ulink url="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/">OMNI </ulink>
2021 (LPGL, free) is a package made by IBM, now containing support for more
2022 than 400 printers, stemming from the inheritance of IBM OS/2 know-how
2023 ported over to Linux (CUPS support is in a beta stage at present).
2027 <ulink url="http://hpinkjet.sourceforge.net/">HPIJS </ulink> (BSD-style licenses, free)
2028 supports approximately 150 of HP's own printers and also provides
2029 excellent print quality now (currently available only via the Foomatic path).
2033 <ulink url="http://www.linuxprinting.org/">Foomatic/cupsomatic </ulink>
2034 (LPGL, free) from Linuxprinting.org provide PPDs for practically every Ghostscript
2035 filter known to the world (including Omni, Gutenprint, and HPIJS).
2042 <title>Printing with Interface Scripts</title>
2045 <indexterm><primary>PCL</primary></indexterm>
2046 <indexterm><primary>lpadmin</primary></indexterm>
2047 CUPS also supports the use of <quote>interface scripts</quote> as known from
2048 System V AT&T printing systems. These are often used for PCL
2049 printers, from applications that generate PCL print jobs. Interface
2050 scripts are specific to printer models. They have a role similar to
2051 PPDs for PostScript printers. Interface scripts may inject the Escape
2052 sequences as required into the print data stream if the user, for example, selects
2053 a certain paper tray, or changes paper orientation, or uses A3
2054 paper. Interface scripts are practically unknown in the Linux
2055 realm. On HP-UX platforms they are more often used. You can use any
2056 working interface script on CUPS too. Just install the printer with
2057 the <command>-i</command> option:
2059 &rootprompt;<userinput>lpadmin -p pclprinter -v socket://11.12.13.14:9100 \
2060 -i /path/to/interface-script</userinput>
2064 Interface scripts might be the <quote>unknown animal</quote> to many. However,
2065 with CUPS they provide the easiest way to plug in your own custom-written filtering
2066 script or program into one specific print queue (some information about the traditional
2067 use of interface scripts is found at
2068 <ulink noescape="1" url="http://playground.sun.com/printing/documentation/interface.html">
2069 http://playground.sun.com/printing/documentation/interface.html</ulink>).
2075 <title>Network Printing (Purely Windows)</title>
2078 Network printing covers a lot of ground. To understand what exactly
2079 goes on with Samba when it is printing on behalf of its Windows
2080 clients, let's first look at a <quote>purely Windows</quote> setup: Windows clients
2081 with a Windows NT print server.
2085 <title>From Windows Clients to an NT Print Server</title>
2088 Windows clients printing to an NT-based print server have two
2090 <indexterm><primary>GDI</primary></indexterm>
2091 <indexterm><primary>EMF</primary></indexterm>
2096 <listitem><para>Execute the driver locally and render the GDI output
2097 (EMF) into the printer-specific format on their own.
2100 <listitem><para>Send the GDI output (EMF) to the server, where the
2101 driver is executed to render the printer-specific output.
2106 Both print paths are shown in the flowcharts in <link linkend="small11">
2107 Print Driver Execution on the Client</link>, and
2108 <link linkend="small12">Print Driver Execution on the Server</link>.
2113 <title>Driver Execution on the Client</title>
2116 In the first case, the print server must spool the file as raw, meaning it shouldn't touch the job file and try
2117 to convert it in any way. This is what a traditional UNIX-based print server can do too, and at a better
2118 performance and more reliably than an NT print server. This is what most Samba administrators probably are
2119 familiar with. One advantage of this setup is that this <quote>spooling-only</quote> print server may be used
2120 even if no driver(s) for UNIX is available. It is sufficient to have the Windows client drivers available and
2121 installed on the clients. This is illustrated in <link linkend="small11">the Print Driver Execution on the
2122 Client diagram</link>.
2125 <figure id="small11">
2126 <title>Print Driver Execution on the Client.</title>
2127 <imagefile>11small</imagefile>
2133 <title>Driver Execution on the Server</title>
2137 <indexterm><primary>PostScript</primary></indexterm>
2138 <indexterm><primary>PCL</primary></indexterm>
2139 <indexterm><primary>ESC/P</primary></indexterm>
2140 <indexterm><primary>EMF</primary></indexterm>
2141 <indexterm><primary>GDI</primary></indexterm>
2142 The other path executes the printer driver on the server. The client transfers print files in EMF format to
2143 the server. The server uses the PostScript, PCL, ESC/P, or other driver to convert the EMF file into the
2144 printer-specific language. It is not possible for UNIX to do the same. Currently, there is no program or
2145 method to convert a Windows client's GDI output on a UNIX server into something a printer could understand.
2146 This is illustrated in <link linkend="small12">the Print Driver Execution on the Server diagram</link>.
2149 <figure id="small12">
2150 <title>Print Driver Execution on the Server.</title>
2151 <imagefile>12small</imagefile>
2155 However, something similar is possible with CUPS, so read on.
2161 <title>Network Printing (Windows Clients and UNIX/Samba Print
2165 Since UNIX print servers <emphasis>cannot</emphasis> execute the Win32
2166 program code on their platform, the picture is somewhat
2167 different. However, this does not limit your options all that
2168 much. On the contrary, you may have a way here to implement printing
2169 features that are not possible otherwise.
2173 <title>From Windows Clients to a CUPS/Samba Print Server</title>
2176 Here is a simple recipe showing how you can take advantage of CUPS's
2177 powerful features for the benefit of your Windows network printing
2182 <listitem><para>Let the Windows clients send PostScript to the CUPS
2183 server.</para></listitem>
2185 <listitem><para>Let the CUPS server render the PostScript into device-specific raster format.</para></listitem>
2189 This requires the clients to use a PostScript driver (even if the
2190 printer is a non-PostScript model. It also requires that you have a
2191 driver on the CUPS server.
2195 First, to enable CUPS-based printing through Samba, the following options should be set in your &smb.conf;
2196 file <parameter>[global]</parameter> section:
2200 <smbconfoption name="printing">cups</smbconfoption>
2201 <smbconfoption name="printcap">cups</smbconfoption>
2205 When these parameters are specified, all manually set print directives (like <smbconfoption name="print
2206 command"/> or <smbconfoption name="lppause command"/>) in &smb.conf; (as well as in Samba itself) will be
2207 ignored. Instead, Samba will directly interface with CUPS through its application program interface (API), as
2208 long as Samba has been compiled with CUPS library (libcups) support. If Samba has not been compiled with CUPS
2209 support, and if no other print commands are set up, then printing will use the <emphasis>System V</emphasis>
2210 AT&T command set, with the -oraw option automatically passing through (if you want your own defined print
2211 commands to work with a Samba server that has CUPS support compiled in, simply use <smbconfoption
2212 name="classicalprinting">sysv</smbconfoption>). This is illustrated in <link linkend="f13small">the Printing via
2213 CUPS/Samba Server diagram</link>.
2216 <figure id="f13small">
2217 <title>Printing via CUPS/Samba Server.</title>
2218 <imagefile>13small</imagefile>
2223 <title>Samba Receiving Job-Files and Passing Them to CUPS</title>
2226 Samba <emphasis>must</emphasis> use its own spool directory (it is set by a line similar to <smbconfoption
2227 name="path">/var/spool/samba</smbconfoption>, in the <smbconfsection name="[printers]"/> or <smbconfsection
2228 name="[printername]"/> section of &smb.conf;). Samba receives the job in its own spool space and passes it
2229 into the spool directory of CUPS (the CUPS spool directory is set by the <parameter>RequestRoot</parameter>
2230 directive in a line that defaults to <parameter>RequestRoot /var/spool/cups</parameter>). CUPS checks the
2231 access rights of its spool directory and resets it to healthy values with every restart. We have seen quite a
2232 few people who used a common spooling space for Samba and CUPS, and struggled for weeks with this
2233 <quote>problem.</quote>
2237 A Windows user authenticates only to Samba (by whatever means is
2238 configured). If Samba runs on the same host as CUPS, you only need to
2239 allow <quote>localhost</quote> to print. If it runs on different machines, you
2240 need to make sure the Samba host gets access to printing on CUPS.
2246 <title>Network PostScript RIP</title>
2249 This section discusses the use of CUPS filters on the server &smbmdash; configuration where
2250 clients make use of a PostScript driver with CUPS-PPDs.
2255 <indexterm><primary>PostScript</primary></indexterm>
2256 <indexterm><primary>PCL</primary></indexterm>
2257 <indexterm><primary>PJL</primary></indexterm>
2258 PPDs can control all print device options. They are usually provided by the manufacturer &smbmdash; if you own
2259 a PostScript printer, that is. PPD files are always a component of PostScript printer drivers on MS Windows or
2260 Apple Mac OS systems. They are ASCII files containing user-selectable print options, mapped to appropriate
2261 PostScript, PCL, or PJL commands for the target printer. Printer driver GUI dialogs translate these options
2262 <quote>on the fly</quote> into buttons and drop-down lists for the user to select.
2266 CUPS can load, without any conversions, the PPD file from any Windows (NT is recommended) PostScript driver
2267 and handle the options. There is a Web browser interface to the print options (select <ulink noescape="1"
2268 url="http://localhost:631/printers/">http://localhost:631/printers/</ulink> and click on one
2269 <guibutton>Configure Printer</guibutton> button to see it) or a command line interface (see <command>man
2270 lpoptions</command> or see if you have <command>lphelp</command> on your system). There are also some
2271 different GUI front-ends on Linux/UNIX, which can present PPD options to users. PPD options are normally meant
2272 to be evaluated by the PostScript RIP on the real PostScript printer.
2276 <title>PPDs for Non-PS Printers on UNIX</title>
2280 <indexterm><primary>PPD</primary></indexterm>
2281 CUPS does not limit itself to <quote>real</quote> PostScript printers in its use of PPDs. The CUPS developers
2282 have extended the scope of the PPD concept to also describe available device and driver options for
2283 non-PostScript printers through CUPS-PPDs.
2287 This is logical, because CUPS includes a fully featured PostScript interpreter (RIP). This RIP is based on
2288 Ghostscript. It can process all received PostScript (and additionally many other file formats) from clients.
2289 All CUPS-PPDs geared to non-PostScript printers contain an additional line, starting with the keyword
2290 <parameter>*cupsFilter</parameter>. This line tells the CUPS print system which printer-specific filter to use
2291 for the interpretation of the supplied PostScript. Thus CUPS lets all its printers appear as PostScript
2292 devices to its clients, because it can act as a PostScript RIP for those printers, processing the received
2293 PostScript code into a proper raster print format.
2298 <title>PPDs for Non-PS Printers on Windows</title>
2301 <indexterm><primary>PPD</primary></indexterm>
2302 CUPS-PPDs can also be used on Windows clients, on top of a <quote>core</quote> PostScript driver (now
2303 recommended is the CUPS PostScript Driver for Windows NT/200x/XP; you can also use the Adobe one, with
2304 limitations). This feature enables CUPS to do a few tricks no other spooler can do:
2309 Act as a networked PostScript RIP handling print files from all client platforms in a uniform way.
2313 Act as a central accounting and billing server, since all files are passed through the pstops filter and are therefore
2314 logged in the CUPS <filename>page_log</filename> file. <emphasis>Note:</emphasis> this cannot happen with
2315 <quote>raw</quote> print jobs, which always remain unfiltered per definition.
2319 Enable clients to consolidate on a single PostScript driver, even for many different target printers.
2324 Using CUPS PPDs on Windows clients enables them to control all print job settings just as a UNIX client can do.
2330 <title>Windows Terminal Servers (WTS) as CUPS Clients</title>
2333 This setup may be of special interest to people experiencing major problems in WTS environments. WTS often
2334 need a multitude of non-PostScript drivers installed to run their clients' variety of different printer
2335 models. This often imposes the price of much increased instability.
2339 <title>Printer Drivers Running in <quote>Kernel Mode</quote> Cause Many
2343 Windows NT printer drivers, which run in <quote>kernel mode</quote>, introduce a high risk for the stability
2344 of the system if the driver is not really stable and well-tested. And there are a lot of bad drivers out
2345 there! Especially notorious is the example of the PCL printer driver that had an additional sound module
2346 running to notify users via soundcard of their finished jobs. Do I need to say that this one was also reliably
2347 causing <quote>blue screens of death</quote> on a regular basis?
2351 PostScript drivers are generally well-tested. They are not known to cause any problems, even though they also
2352 run in kernel mode. This might be because until now there have been only two different PostScript drivers: the
2353 one from Adobe and the one from Microsoft. Both are well-tested and are as stable as you can imagine on
2354 Windows. The CUPS driver is derived from the Microsoft one.
2359 <title>Workarounds Impose Heavy Limitations</title>
2362 In an attempt to work around problems, site administrators have resorted to restricting the
2363 allowed drivers installed on their WTS to one generic PCL and one PostScript driver. This, however, restricts
2364 the number of printer options available for clients to use. Often they can't get out more than simplex
2365 prints from one standard paper tray, while their devices could do much better if driven by a different driver!
2370 <title>CUPS: A <quote>Magical Stone</quote>?</title>
2373 <indexterm><primary>PPD</primary></indexterm>
2374 <indexterm><primary>PostScript</primary></indexterm>
2375 Using a PostScript driver, enabled with a CUPS-PPD, seems to be a very elegant way to overcome all these
2376 shortcomings. There are, depending on the version of Windows OS you use, up to three different PostScript
2377 drivers now available: Adobe, Microsoft, and CUPS PostScript drivers. None of them is known to cause major
2378 stability problems on WTS (even if used with many different PPDs). The clients will be able to (again) choose
2379 paper trays, duplex printing, and other settings. However, there is a certain price for this too: a CUPS
2380 server acting as a PostScript RIP for its clients requires more CPU and RAM than when just acting as a
2381 <quote>raw spooling</quote> device. Plus, this setup is not yet widely tested, although the first feedbacks
2382 look very promising.
2387 <title>PostScript Drivers with No Major Problems, Even in Kernel
2391 <indexterm><primary>DDK</primary></indexterm>
2392 <indexterm><primary>W32X86</primary></indexterm>
2393 <indexterm><primary>PostScript</primary></indexterm>
2394 <indexterm><primary>Visual Studio</primary></indexterm>
2395 <indexterm><primary>Microsoft driver</primary></indexterm>
2396 <indexterm><primary>Adobe</primary></indexterm>
2397 More recent printer drivers on W200x and XP no longer run in kernel mode (unlike Windows NT). However, both
2398 operating systems can still use the NT drivers, running in kernel mode (you can roughly tell which is which as
2399 the drivers in subdirectory <quote>2</quote> of <quote>W32X86</quote> are <quote>old</quote> ones). As was
2400 said before, the Adobe as well as the Microsoft PostScript drivers are not known to cause any stability
2401 problems. The CUPS driver is derived from the Microsoft one. There is a simple reason for this: the MS DDK
2402 (Device Development Kit) for Windows NT (which used to be available at no cost to licensees of Visual Studio)
2403 includes the source code of the Microsoft driver, and licensees of Visual Studio are allowed to use and modify
2404 it for their own driver development efforts. This is what the CUPS people have done. The license does not
2405 allow them to publish the whole of the source code. However, they have released the <quote>diff</quote> under
2406 the GPL, and if you are the owner of an <quote>MS DDK for Windows NT,</quote> you can check the driver
2413 <title>Configuring CUPS for Driver Download</title>
2416 As we have said before, all previously known methods to prepare client printer drivers on the Samba server for
2417 download and Point'n'Print convenience of Windows workstations are working with CUPS, too. These methods were
2418 described in <link linkend="classicalprinting">Classical Printing</link>. In reality, this is a pure Samba
2419 business and relates only to the Samba-Windows client relationship.
2423 <title><emphasis>cupsaddsmb</emphasis>: The Unknown Utility</title>
2427 <indexterm><primary>cupsaddsmb</primary></indexterm>
2428 The <parameter>cupsaddsmb</parameter> utility (shipped with all current CUPS versions) is an alternative
2429 method to transfer printer drivers into the Samba <smbconfsection name="[print$]"/> share. Remember, this
2430 share is where clients expect drivers deposited and set up for download and installation. It makes the sharing
2431 of any (or all) installed CUPS printers quite easy. <command>cupsaddsmb</command> can use the Adobe PostScript
2432 driver as well as the newly developed CUPS PostScript driver for Windows NT/200x/XP.
2433 <parameter>cupsaddsmb</parameter> does <emphasis>not</emphasis> work with arbitrary vendor printer drivers,
2434 but only with the <emphasis>exact</emphasis> driver files that are named in its man page.
2438 The CUPS printer driver is available from the CUPS download site. Its package name is
2439 <filename>cups-samba-[version].tar.gz</filename>. It is preferred over the Adobe drivers because it has a
2440 number of advantages:
2444 <listitem><para>It supports a much more accurate page accounting.</para></listitem>
2446 <listitem><para>It supports banner pages and page labels on all printers.</para></listitem>
2448 <listitem><para>It supports the setting of a number of job IPP attributes
2449 (such as job priority, page label, and job billing).</para></listitem>
2453 However, currently only Windows NT, 2000, and XP are supported by the
2454 CUPS drivers. You will also need to get the respective part of the Adobe driver
2455 if you need to support Windows 95, 98, and Me clients.
2460 <title>Prepare Your &smb.conf; for <command>cupsaddsmb</command></title>
2463 Prior to running <command>cupsaddsmb</command>, you need the settings in
2464 &smb.conf; as shown in <link linkend="cupsadd-ex">the &smb.conf; for cupsaddsmb Usage</link>.
2467 <example id="cupsadd-ex">
2468 <title>smb.conf for cupsaddsmb Usage</title>
2470 <smbconfsection name="[global]"/>
2471 <smbconfoption name="load printers">yes</smbconfoption>
2472 <smbconfoption name="printing">cups</smbconfoption>
2473 <smbconfoption name="printcap name">cups</smbconfoption>
2475 <smbconfsection name="[printers]"/>
2476 <smbconfoption name="comment">All Printers</smbconfoption>
2477 <smbconfoption name="path">/var/spool/samba</smbconfoption>
2478 <smbconfoption name="browseable">no</smbconfoption>
2479 <smbconfcomment>setting depends on your requirements</smbconfcomment>
2480 <smbconfoption name="guest ok">yes</smbconfoption>
2481 <smbconfoption name="writable">no</smbconfoption>
2482 <smbconfoption name="printable">yes</smbconfoption>
2483 <smbconfoption name="printer admin">root</smbconfoption>
2484 <smbconfsection name="[print$]"/>
2485 <smbconfoption name="comment">Printer Drivers</smbconfoption>
2486 <smbconfoption name="path">/etc/samba/drivers</smbconfoption>
2487 <smbconfoption name="browseable">yes</smbconfoption>
2488 <smbconfoption name="guest ok">no</smbconfoption>
2489 <smbconfoption name="read only">yes</smbconfoption>
2490 <smbconfoption name="write list">root, @smbprintadm</smbconfoption>
2496 <title>CUPS <quote>PostScript Driver for Windows NT/200x/XP</quote></title>
2499 <indexterm><primary>PostScript</primary></indexterm>
2500 CUPS users may get the exact same package from <ulink noescape="1"
2501 url="http://www.cups.org/software.html">http://www.cups.org/software.html</ulink>. It is a separate package
2502 from the CUPS-based software files, tagged as CUPS 1.1.x Windows NT/200x/XP Printer Driver for Samba (tar.gz,
2503 192k). The filename to download is <filename>cups-samba-1.1.x.tar.gz</filename>. Upon untar and unzipping, it
2504 will reveal these files:
2506 &rootprompt;<userinput>tar xvzf cups-samba-1.1.19.tar.gz</userinput>
2515 <indexterm><primary>ESP</primary><secondary>meta packager</secondary></indexterm>
2516 <indexterm><primary>EPM</primary><see>ESP meta packager</see></indexterm>
2517 These have been packaged with the ESP meta-packager software EPM. The <filename>*.install</filename> and
2518 <filename>*.remove</filename> files are simple shell scripts, which untar the <filename>*.ss</filename> (the
2519 <filename>*.ss</filename> is nothing else but a tar archive, which can be untarred by <quote>tar</quote> too).
2520 Then it puts the content into <filename>/usr/share/cups/drivers/</filename>. This content includes three
2523 &rootprompt;<userinput>tar tv cups-samba.ss</userinput>
2530 The <parameter>cups-samba.install</parameter> shell scripts are easy to
2533 &rootprompt;<userinput>./cups-samba.install</userinput>
2535 Installing software...
2536 Updating file permissions...
2537 Running post-install commands...
2538 Installation is complete.
2542 The script should automatically put the driver files into the
2543 <filename>/usr/share/cups/drivers/</filename> directory:
2545 &rootprompt;<userinput>cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/</userinput>
2549 Due to a bug, one recent CUPS release puts the <filename>cups.hlp</filename> driver file
2550 into<filename>/usr/share/drivers/</filename> instead of <filename>/usr/share/cups/drivers/</filename>. To work
2551 around this, copy/move the file (after running the <command>./cups-samba.install</command> script) manually to
2556 <indexterm><primary>DDK</primary></indexterm>
2557 This new CUPS PostScript driver is currently binary only, but free of charge. No complete source code is
2558 provided (yet). The reason is that it has been developed with the help of the Microsoft DDK and compiled with
2559 Microsoft Visual Studio 6. Driver developers are not allowed to distribute the whole of the source code as
2560 free software. However, CUPS developers released the <quote>diff</quote> in source code under the GPL, so
2561 anybody with a license for Visual Studio and a DDK will be able to compile for himself or herself.
2566 <title>Recognizing Different Driver Files</title>
2569 The CUPS drivers do not support the older Windows 95/98/Me, but only the Windows NT/2000/XP client.
2572 <para>Windows NT, 2000, and XP are supported by:</para>
2575 <listitem><para>cups.hlp</para></listitem>
2576 <listitem><para>cupsdrvr.dll</para></listitem>
2577 <listitem><para>cupsui.dll</para></listitem>
2581 Adobe drivers are available for the older Windows 95/98/Me as well as
2582 for Windows NT/2000/XP clients. The set of files is different from the
2583 different platforms.
2586 <para>Windows 95, 98, and ME are supported by:</para>
2589 <listitem><para>ADFONTS.MFM</para></listitem>
2590 <listitem><para>ADOBEPS4.DRV</para></listitem>
2591 <listitem><para>ADOBEPS4.HLP</para></listitem>
2592 <listitem><para>DEFPRTR2.PPD</para></listitem>
2593 <listitem><para>ICONLIB.DLL</para></listitem>
2594 <listitem><para>PSMON.DLL</para></listitem>
2597 <para>Windows NT, 2000, and XP are supported by:</para>
2600 <listitem><para>ADOBEPS5.DLL</para></listitem>
2601 <listitem><para>ADOBEPSU.DLL</para></listitem>
2602 <listitem><para>ADOBEPSU.HLP</para></listitem>
2606 <indexterm><primary>Adobe driver files</primary></indexterm>
2607 If both the Adobe driver files and the CUPS driver files for the support of Windows NT/200x/XP are presently
2608 installed on the server, the Adobe files will be ignored and the CUPS files will be used. If you prefer
2609 &smbmdash; for whatever reason &smbmdash; to use Adobe-only drivers, move away the three CUPS driver files.
2610 The Windows 9x/Me clients use the Adobe drivers in any case.
2615 <title>Acquiring the Adobe Driver Files</title>
2618 Acquiring the Adobe driver files seems to be unexpectedly difficult for many users. They are not available on
2619 the Adobe Web site as single files, and the self-extracting and/or self-installing Windows-.exe is not easy to
2620 locate either. You probably need to use the included native installer and run the installation process on one
2621 client once. This will install the drivers (and one generic PostScript printer) locally on the client. When
2622 they are installed, share the generic PostScript printer. After this, the client's <smbconfsection
2623 name="[print$]"/> share holds the Adobe files, which you can get with smbclient from the CUPS host.
2628 <title>ESP Print Pro PostScript Driver for Windows NT/200x/XP</title>
2631 <indexterm><primary>ESP</primary><secondary>Print Pro</secondary></indexterm>
2632 Users of the ESP Print Pro software are able to install the ESP print drivers package as an alternative to the
2633 Adobe PostScript drivers. To do so, retrieve the driver files from the normal download area of the ESP Print
2634 Pro software at <ulink noescape="1" url="http://www.easysw.com/software.html">Easy Software</ulink> web site.
2635 You need to locate the link labeled <quote>SAMBA</quote> among the <guilabel>Download Printer Drivers for ESP
2636 Print Pro 4.x</guilabel> area and download the package. Once installed, you can prepare any driver by simply
2637 highlighting the printer in the Printer Manager GUI and selecting <guilabel>Export Driver...</guilabel> from
2638 the menu. Of course, you need to have prepared Samba beforehand to handle the driver files; that is, set up
2639 the <smbconfsection name="[print$]"/> share, and so on. The ESP Print Pro package includes the CUPS driver
2640 files as well as a (licensed) set of Adobe drivers for the Windows 95/98/Me client family.
2645 <title>Caveats to Be Considered</title>
2649 <indexterm><primary>cupsaddsmb</primary></indexterm>
2650 <indexterm><primary>cups.hlp</primary></indexterm>
2651 <indexterm><primary>WIN40</primary></indexterm>
2652 <indexterm><primary>W32X86</primary></indexterm>
2653 Once you have run the install script (and possibly manually moved the <filename>cups.hlp</filename> file to
2654 <filename>/usr/share/cups/drivers/</filename>), the driver is ready to be put into Samba's <smbconfsection
2655 name="[print$]"/> share (which often maps to <filename>/etc/samba/drivers/</filename> and contains a
2656 subdirectory tree with <emphasis>WIN40</emphasis> and <emphasis>W32X86</emphasis> branches). You do this by
2657 running <command>cupsaddsmb</command> (see also <command>man cupsaddsmb</command> for CUPS since release
2662 <indexterm><primary>Single Sign-On</primary></indexterm>
2663 <indexterm><primary>Domain Controller</primary></indexterm>
2664 You may need to put root into the smbpasswd file by running <command>smbpasswd</command>; this is especially
2665 important if you should run this whole procedure for the first time and are not working in an environment
2666 where everything is configured for <emphasis>single sign-on</emphasis> to a Windows Domain Controller.
2670 Once the driver files are in the <smbconfsection name="[print$]"/> share and are initialized, they are ready
2671 to be downloaded and installed by the Windows NT/200x/XP clients.
2675 Win 9x/Me clients will not work with the CUPS PostScript driver. For these you still need to use the
2676 <filename>ADOBE*.*</filename> drivers, as previously stated.
2681 It is not harmful if you still have the <filename>ADOBE*.*</filename> driver files from previous installations
2682 in the <filename>/usr/share/cups/drivers/</filename> directory. The new <command>cupsaddsmb</command> (from
2683 1.1.16) will automatically prefer its own drivers if it finds both.
2687 <indexterm><primary>"Printers" folder</primary></indexterm>
2688 <indexterm><primary>Adobe PostScript</primary></indexterm>
2689 Should your Windows clients have had the old <filename>ADOBE*.*</filename> files for the Adobe PostScript
2690 driver installed, the download and installation of the new CUPS PostScript driver for Windows NT/200x/XP will
2691 fail at first. You need to wipe the old driver from the clients first. It is not enough to
2692 <quote>delete</quote> the printer, because the driver files will still be kept by the clients and re-used if
2693 you try to re-install the printer. To really get rid of the Adobe driver files on the clients, open the
2694 <guilabel>Printers</guilabel> folder (possibly via <guilabel>Start -> Settings -> Control Panel ->
2695 Printers</guilabel>), right-click on the folder background, and select <guimenuitem>Server
2696 Properties</guimenuitem>. When the new dialog opens, select the <guilabel>Drivers</guilabel> tab. On the list
2697 select the driver you want to delete and click the <guilabel>Delete</guilabel> button. This will only work if
2698 there is not one single printer left that uses that particular driver. You need to <quote>delete</quote> all
2699 printers using this driver in the <guilabel>Printers</guilabel> folder first. You will need Administrator
2700 privileges to do this.
2704 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
2705 <indexterm><primary>CUPS PostScript</primary></indexterm>
2706 Once you have successfully downloaded the CUPS PostScript driver to a client, you can easily switch all
2707 printers to this one by proceeding as described in <link linkend="classicalprinting">Classical Printing
2708 Support</link>. Either change a driver for an existing printer by running the <guilabel>Printer
2709 Properties</guilabel> dialog, or use <command>rpcclient</command> with the <command>setdriver</command>
2715 <title>Windows CUPS PostScript Driver Versus Adobe Driver</title>
2718 Are you interested in a comparison between the CUPS and the Adobe PostScript drivers? For our purposes, these
2719 are the most important items that weigh in favor of CUPS:
2723 <listitem><para>No hassle with the Adobe EULA.</para></listitem>
2725 <listitem><para>No hassle with the question, <quote>Where do I
2726 get the ADOBE*.* driver files?</quote></para></listitem>
2729 <indexterm><primary>PJL</primary></indexterm>
2730 The Adobe drivers (on request of the printer PPD associated with them) often put a PJL header in front of the
2731 main PostScript part of the print file. Thus, the print file starts with <parameter><1B
2732 >%-12345X</parameter> or <parameter><escape>%-12345X</parameter> instead of
2733 <parameter>%!PS</parameter>. This leads to the CUPS daemon autotyping the incoming file as a print-ready file,
2734 not initiating a pass through the <parameter>pstops</parameter> filter (to speak more technically, it is not
2735 regarded as the generic MIME-type <indexterm><primary>application/postscript</primary></indexterm>
2736 <parameter>application/postscript</parameter>, but as the more special MIME type
2737 <indexterm><primary>application/cups.vnd-postscript</primary></indexterm>
2738 <parameter>application/cups.vnd-postscript</parameter>), which therefore also leads to the page accounting in
2739 <parameter>/var/log/cups/page_log</parameter> not receiving the exact number of pages; instead the dummy page
2740 number of <quote>1</quote> is logged in a standard setup).
2743 <listitem><para>The Adobe driver has more options to misconfigure the
2744 <indexterm><primary>Adobe driver</primary></indexterm>
2745 PostScript generated by it (like setting it inadvertently to
2746 <guilabel>Optimize for Speed</guilabel> instead of
2747 <guilabel>Optimize for Portability</guilabel>, which
2748 could lead to CUPS being unable to process it).</para></listitem>
2750 <listitem><para>The CUPS PostScript driver output sent by Windows
2751 <indexterm><primary>CUPS PostScript driver</primary></indexterm>
2752 clients to the CUPS server is guaranteed to autotype
2753 as the generic MIME type <parameter>application/postscript</parameter>,
2754 thus passing through the CUPS <parameter>pstops</parameter> filter and logging the
2755 correct number of pages in the <filename>page_log</filename> for
2756 accounting and quota purposes.</para></listitem>
2759 <indexterm><primary>banner pages</primary></indexterm>
2760 The CUPS PostScript driver supports the sending of additional standard (IPP) print options by Windows
2761 NT/200x/XP clients. Such additional print options are naming the CUPS standard <emphasis>banner
2762 pages</emphasis> (or the custom ones, should they be installed at the time of driver download), using the CUPS
2763 page-label option, setting a job priority, and setting the scheduled time of printing (with the option to
2764 support additional useful IPP job attributes in the future).
2767 <listitem><para>The CUPS PostScript driver supports the inclusion of
2768 the new <parameter>*cupsJobTicket</parameter> comments at the
2769 beginning of the PostScript file (which could be used in the future
2770 for all sorts of beneficial extensions on the CUPS side, but which will
2771 not disturb any other applications because they will regard it as a comment
2772 and simply ignore it).</para></listitem>
2774 <listitem><para>The CUPS PostScript driver will be the heart of the
2775 fully fledged CUPS IPP client for Windows NT/200x/XP to be released soon
2776 (probably alongside the first beta release for CUPS 1.2).</para></listitem>
2782 <title>Run cupsaddsmb (Quiet Mode)</title>
2786 <indexterm><primary>cupsaddsmb</primary></indexterm>
2787 <indexterm><primary>point 'n' print</primary></indexterm>
2788 The <command>cupsaddsmb</command> command copies the needed files into your <smbconfsection name="[print$]"/>
2789 share. Additionally, the PPD associated with this printer is copied from <filename>/etc/cups/ppd/</filename>
2790 to <smbconfsection name="[print$]"/>. There the files wait for convenient Windows client installations via
2791 Point'n'Print. Before we can run the command successfully, we need to be sure that we can authenticate toward
2792 Samba. If you have a small network, you are probably using user-level security (<smbconfoption
2793 name="security">user</smbconfoption>).
2797 Here is an example of a successfully run <command>cupsaddsmb</command> command:
2798 <indexterm><primary>banner pages</primary></indexterm>
2799 <indexterm><primary>cupsaddsmb</primary></indexterm>
2801 &rootprompt;<userinput>cupsaddsmb -U root infotec_IS2027</userinput>
2802 Password for root required to access localhost via Samba: <userinput>['secret']</userinput>
2806 <indexterm><primary>cupsaddsmb</primary></indexterm>
2807 To share <emphasis>all</emphasis> printers and drivers, use the
2808 <option>-a</option> parameter instead of a printer name. Since
2809 <command>cupsaddsmb</command> <quote>exports</quote> the printer drivers to Samba, it should be
2810 obvious that it only works for queues with a CUPS driver associated.
2815 <title>Run cupsaddsmb with Verbose Output</title>
2819 <indexterm><primary>cupsaddsmb</primary></indexterm>
2820 Probably you want to see what's going on. Use the
2821 <option>-v</option> parameter to get a more verbose output. The
2822 output below was edited for better readability: all <quote>\</quote> at the end of
2823 a line indicate that I inserted an artificial line break plus some
2825 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
2826 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
2828 &rootprompt;<userinput>cupsaddsmb -U root -v infotec_2105</userinput>
2829 Password for root required to access localhost via &example.server.samba;:
2830 Running command: smbclient //localhost/print\$ -N -U'root%secret' \
2832 put /var/spool/cups/tmp/3e98bf2d333b5 W32X86/infotec_2105.ppd; \
2833 put /usr/share/cups/drivers/cupsdrvr.dll W32X86/cupsdrvr.dll; \
2834 put /usr/share/cups/drivers/cupsui.dll W32X86/cupsui.dll; \
2835 put /usr/share/cups/drivers/cups.hlp W32X86/cups.hlp'
2836 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
2837 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
2838 NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86
2839 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \W32X86/infotec_2105.ppd
2840 putting file /usr/share/cups/drivers/cupsdrvr.dll as \W32X86/cupsdrvr.dll
2841 putting file /usr/share/cups/drivers/cupsui.dll as \W32X86/cupsui.dll
2842 putting file /usr/share/cups/drivers/cups.hlp as \W32X86/cups.hlp
2844 Running command: rpcclient localhost -N -U'root%secret'
2845 -c 'adddriver "Windows NT x86" \
2846 "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \
2848 cmd = adddriver "Windows NT x86" \
2849 "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \
2851 Printer Driver infotec_2105 successfully installed.
2853 Running command: smbclient //localhost/print\$ -N -U'root%secret' \
2855 put /var/spool/cups/tmp/3e98bf2d333b5 WIN40/infotec_2105.PPD; \
2856 put /usr/share/cups/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM; \
2857 put /usr/share/cups/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV; \
2858 put /usr/share/cups/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP; \
2859 put /usr/share/cups/drivers/DEFPRTR2.PPD WIN40/DEFPRTR2.PPD; \
2860 put /usr/share/cups/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL; \
2861 put /usr/share/cups/drivers/PSMON.DLL WIN40/PSMON.DLL;'
2862 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
2863 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
2864 NT_STATUS_OBJECT_NAME_COLLISION making remote directory \WIN40
2865 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \WIN40/infotec_2105.PPD
2866 putting file /usr/share/cups/drivers/ADFONTS.MFM as \WIN40/ADFONTS.MFM
2867 putting file /usr/share/cups/drivers/ADOBEPS4.DRV as \WIN40/ADOBEPS4.DRV
2868 putting file /usr/share/cups/drivers/ADOBEPS4.HLP as \WIN40/ADOBEPS4.HLP
2869 putting file /usr/share/cups/drivers/DEFPRTR2.PPD as \WIN40/DEFPRTR2.PPD
2870 putting file /usr/share/cups/drivers/ICONLIB.DLL as \WIN40/ICONLIB.DLL
2871 putting file /usr/share/cups/drivers/PSMON.DLL as \WIN40/PSMON.DLL
2873 Running command: rpcclient localhost -N -U'root%secret' \
2874 -c 'adddriver "Windows 4.0" \
2875 "infotec_2105:ADOBEPS4.DRV:infotec_2105.PPD:NULL:ADOBEPS4.HLP: \
2876 PSMON.DLL:RAW:ADOBEPS4.DRV,infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL, \
2877 ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"'
2878 cmd = adddriver "Windows 4.0" "infotec_2105:ADOBEPS4.DRV:\
2879 infotec_2105.PPD:NULL:ADOBEPS4.HLP:PSMON.DLL:RAW:ADOBEPS4.DRV,\
2880 infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL,ADFONTS.MFM,DEFPRTR2.PPD,\
2882 Printer Driver infotec_2105 successfully installed.
2884 Running command: rpcclient localhost -N -U'root%secret' \
2885 -c 'setdriver infotec_2105 infotec_2105'
2886 cmd = setdriver infotec_2105 infotec_2105
2887 Successfully set infotec_2105 to driver infotec_2105.
2891 You will see the root password for the Samba account printed on screen.
2895 If you look closely, you'll discover your root password was transferred unencrypted over the wire, so beware!
2896 Also, if you look further, you may discover error messages like NT_STATUS_OBJECT_NAME_COLLISION in the output.
2897 This will occur when the directories WIN40 and W32X86 already existed in the <smbconfsection name="[print$]"/>
2898 driver download share (from a previous driver installation). These are harmless warning messages.
2903 <title>Understanding cupsaddsmb</title>
2906 <indexterm><primary>cupsaddsmb</primary></indexterm>
2907 What has happened? What did <command>cupsaddsmb</command> do? There are five stages of the procedure:
2912 <indexterm><primary>IPP</primary></indexterm>
2913 Call the CUPS server via IPP and request the driver files and the PPD file for the named printer.</para></listitem>
2915 <listitem><para>Store the files temporarily in the local TEMPDIR (as defined in <filename>cupsd.conf</filename>).</para></listitem>
2917 <listitem><para>Connect via smbclient to the Samba server's <smbconfsection name="[print$]"/> share and put the files into the
2918 share's WIN40 (for Windows 9x/Me) and W32X86 (for Windows NT/200x/XP) subdirectories.</para></listitem>
2921 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
2922 Connect via rpcclient to the Samba server and execute the <command>adddriver</command> command with the correct parameters.
2926 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
2927 Connect via rpcclient to the Samba server a second time and execute the <command>setdriver</command> command.</para></listitem>
2932 You can run the <command>cupsaddsmb</command> utility with parameters to specify one remote host as Samba host
2933 and a second remote host as CUPS host. Especially if you want to get a deeper understanding, it is a good idea
2934 to try it and see more clearly what is going on (though in real life most people will have their CUPS and
2935 Samba servers run on the same host):
2937 &rootprompt;<userinput>cupsaddsmb -H sambaserver -h cupsserver -v printer</userinput>
2944 <title>How to Recognize If cupsaddsmb Completed Successfully</title>
2947 You <emphasis>must</emphasis> always check if the utility completed
2948 successfully in all fields. You need at minimum these three messages
2953 <listitem><para><emphasis>Printer Driver infotec_2105 successfully
2954 installed.</emphasis> # (for the W32X86 == Windows NT/200x/XP
2955 architecture).</para></listitem>
2957 <listitem><para><emphasis>Printer Driver infotec_2105 successfully
2958 installed.</emphasis> # (for the WIN40 == Windows 9x/Me
2959 architecture).</para></listitem>
2961 <listitem><para><emphasis>Successfully set [printerXPZ] to driver
2962 [printerXYZ].</emphasis></para></listitem>
2966 These messages are probably not easily recognized in the general
2967 output. If you run <command>cupsaddsmb</command> with the <option>-a</option>
2968 parameter (which tries to prepare <emphasis>all</emphasis> active CUPS
2969 printer drivers for download), you might miss if individual printer
2970 drivers had problems installing properly. A redirection of the
2971 output will help you analyze the results in retrospective.
2977 SetPrinter call failed!
2978 result was WERR_ACCESS_DENIED
2980 it means that you might have set <smbconfoption name="use client driver">yes</smbconfoption> for this printer.
2981 Setting it to <quote>no</quote> will solve the problem. Refer to the &smb.conf; man page for explanation of
2982 the <parameter>use client driver</parameter>.
2986 It is impossible to see any diagnostic output if you do not run <command>cupsaddsmb</command> in verbose mode.
2987 Therefore, we strongly recommend against use of the default quiet mode. It will hide any problems from you that
2993 <title>cupsaddsmb with a Samba PDC</title>
2996 <indexterm><primary>cupsaddsmb</primary></indexterm>
2997 <indexterm><primary>PDC</primary></indexterm>
2998 Can't get the standard <command>cupsaddsmb</command> command to run on a Samba PDC? Are you asked for the
2999 password credential again and again, and the command just will not take off at all? Try one of these
3004 &rootprompt;<userinput>cupsaddsmb -U &example.workgroup;\\root -v printername</userinput>
3005 &rootprompt;<userinput>cupsaddsmb -H &example.pdc.samba; -U &example.workgroup;\\root -v printername</userinput>
3006 &rootprompt;<userinput>cupsaddsmb -H &example.pdc.samba; -U &example.workgroup;\\root -h cups-server -v printername</userinput>
3010 (Note the two backslashes: the first one is required to <quote>escape</quote> the second one).
3015 <title>cupsaddsmb Flowchart</title>
3018 <indexterm><primary>cupsaddsmb</primary></indexterm>
3019 <indexterm><primary>raw print</primary></indexterm>
3020 <link linkend="small14">The cupsaddsmb Flowchart</link> shows a chart about the procedures, command flows, and
3021 data flows of the <command>cupaddsmb</command> command. Note again: cupsaddsmb is
3022 not intended to, and does not work with, raw print queues!
3025 <figure id="small14">
3026 <title>cupsaddsmb Flowchart.</title>
3027 <imagefile>14small</imagefile></figure>
3031 <title>Installing the PostScript Driver on a Client</title>
3034 <indexterm><primary>point'n'print</primary></indexterm>
3035 <indexterm><primary>cupsaddsmb</primary></indexterm>
3036 After <command>cupsaddsmb</command> is completed, your driver is prepared for the clients to use. Here are the
3037 steps you must perform to download and install it via Point'n'Print. From a Windows client, browse to the
3044 <indexterm><primary>"Printers" folder</primary></indexterm>
3045 Open the <guilabel>Printers</guilabel> share of Samba in Network Neighborhood.</para></listitem>
3047 <listitem><para>Right-click on the printer in question.</para></listitem>
3049 <listitem><para>From the opening context menu select
3050 <guimenuitem>Install...</guimenuitem> or
3051 <guimenuitem>Connect...</guimenuitem> (depending on the Windows version you use).</para></listitem>
3055 After a few seconds, there should be a new printer in your client's <emphasis>local</emphasis>
3056 <guilabel>Printers</guilabel> folder. On Windows XP it will follow a naming convention of
3057 <emphasis>PrinterName on SambaServer</emphasis>. (In my current case it is infotec_2105 on kde-bitshop). If
3058 you want to test it and send your first job from an application like Microsoft Word,
3059 the new printer appears in a
3060 <filename>\\SambaServer\PrinterName</filename> entry in the drop-down list of available printers.
3064 <indexterm><primary>PPD</primary></indexterm>
3065 <indexterm><primary>Adobe PostScript driver</primary></indexterm>
3066 <indexterm><primary>net use lpt1:</primary></indexterm>
3067 <command>cupsaddsmb</command> will only reliably work with CUPS version 1.1.15 or higher and with Samba
3068 version 2.2.4, or later. If it does not work, or if the automatic printer driver download to the clients does
3069 not succeed, you can still manually install the CUPS printer PPD on top of the Adobe PostScript driver on
3070 clients. Then point the client's printer queue to the Samba printer share for a UNC type of connection:
3072 &dosprompt;<userinput>net use lpt1: \\sambaserver\printershare /user:ntadmin</userinput>
3074 should you desire to use the CUPS networked PostScript RIP functions. (Note that user <quote>ntadmin</quote>
3075 needs to be a valid Samba user with the required privileges to access the printershare.) This sets up the
3076 printer connection in the traditional LanMan way (not using MS-RPC).
3080 <sect2 id="cups-avoidps1">
3081 <title>Avoiding Critical PostScript Driver Settings on the Client</title>
3084 Printing works, but there are still problems. Most jobs print well, some do not print at all. Some jobs have
3085 problems with fonts, which do not look very good. Some jobs print fast and some are dead-slow. Many of these
3086 problems can be greatly reduced or even completely eliminated if you follow a few guidelines. Remember, if
3087 your print device is not PostScript-enabled, you are treating your Ghostscript installation on your CUPS host
3088 with the output your client driver settings produce. Treat it well:
3093 Avoid the PostScript Output Option: Optimize for Speed setting. Use the Optimize for Portability instead
3094 (Adobe PostScript driver).</para></listitem>
3097 Don't use the Page Independence: NO setting. Instead, use Page Independence: YES (CUPS PostScript Driver).
3101 Recommended is the True Type Font Downloading Option: Native True Type over Automatic and Outline;
3102 you should by all means avoid Bitmap (Adobe PostScript Driver).</para></listitem>
3105 Choose True Type Font: Download as Softfont into Printer over the default Replace by Device
3106 Font (for exotic fonts, you may need to change it back to get a printout at all; Adobe).</para></listitem>
3109 Sometimes you can choose PostScript Language Level: in case of problems try 2
3110 instead of 3 (the latest ESP Ghostscript package handles Level 3 PostScript very well; Adobe).
3114 Say Yes to PostScript Error Handler (Adobe).</para></listitem>
3121 <title>Installing PostScript Driver Files Manually Using rpcclient</title>
3124 Of course, you can run all the commands that are embedded into the
3125 cupsaddsmb convenience utility yourself, one by one, and upload
3126 and prepare the driver files for future client downloads.
3130 <listitem><para>Prepare Samba (a CUPS print queue with the name of the
3131 printer should be there. We are providing the driver now).</para></listitem>
3133 <listitem><para>Copy all files to <smbconfsection name="[print$]"/>.</para></listitem>
3136 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3137 Run <command>rpcclient adddriver</command>
3138 (for each client architecture you want to support).</para></listitem>
3141 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3142 Run <command>rpcclient setdriver.</command></para></listitem>
3146 <indexterm><primary>rpcclient</primary><secondary>enumports</secondary></indexterm>
3147 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3148 <indexterm><primary>rpcclient</primary><secondary>enumdrivers</secondary></indexterm>
3149 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3150 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3151 We are going to do this now. First, read the man page on <parameter>rpcclient</parameter> to get a first idea.
3152 Look at all the printing-related subcommands: <command>enumprinters</command>, <command>enumdrivers</command>,
3153 <command>enumports</command>, <command>adddriver</command>, and <command>setdriver</command> are among the
3154 most interesting ones. <parameter>rpcclient</parameter> implements an important part of the MS-RPC protocol.
3155 You can use it to query (and command) a Windows NT (or 200x/XP) PC, too. MS-RPC is used by Windows clients,
3156 among other things, to benefit from the Point'n'Print features. Samba can now mimic this as well.
3160 <title>A Check of the rpcclient man Page</title>
3163 First let's check the <parameter>rpcclient</parameter> man page. Here are two relevant passages:
3167 <indexterm><primary>adddriver</primary></indexterm>
3168 <indexterm><primary>AddPrinterDriver()</primary></indexterm>
3169 <indexterm><primary>getdriverdir</primary></indexterm>
3170 <command>adddriver <arch> <config></command> Execute an <command>AddPrinterDriver()</command> RPC
3171 to install the printer driver information on the server. The driver files should already exist in the
3172 directory returned by <command>getdriverdir</command>. Possible values for <parameter>arch</parameter> are the
3173 same as those for the <command>getdriverdir</command> command. The <parameter>config</parameter> parameter is
3181 Language Monitor Name:\
3183 Comma Separated list of Files
3187 Any empty fields should be entered as the string <quote>NULL</quote>.
3191 Samba does not need to support the concept of print monitors, since these only apply to local printers whose
3192 drivers can use a bidirectional link for communication. This field should be <quote>NULL</quote>. On a remote
3193 NT print server, the print monitor for a driver must already be installed before adding the driver or else the
3198 <indexterm><primary>setdriver</primary></indexterm>
3199 <indexterm><primary>SetPrinter()</primary></indexterm>
3200 <command>setdriver <printername> <drivername></command> Execute a <command>SetPrinter()</command>
3201 command to update the printer driver associated with an installed printer. The printer driver must already be
3202 correctly installed on the print server.
3206 <indexterm><primary>enumprinters</primary></indexterm>
3207 <indexterm><primary>enumdrivers</primary></indexterm>
3208 See also the <command>enumprinters</command> and <command>enumdrivers</command> commands to
3209 obtain a list of installed printers and drivers.
3215 <title>Understanding the rpcclient man Page</title>
3218 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3219 The <emphasis>exact</emphasis> format isn't made too clear by the man page, since you have to deal with some
3220 parameters containing spaces. Here is a better description for it. We have line-broken the command and
3221 indicated the breaks with <quote>\</quote>. Usually you would type the command in one line without the line
3224 adddriver "Architecture" \
3225 "LongPrinterName:DriverFile:DataFile:ConfigFile:HelpFile:\
3226 LanguageMonitorFile:DataType:ListOfFiles,Comma-separated"
3230 What the man pages denote as a simple <parameter><config></parameter> keyword in reality consists of
3231 eight colon-separated fields. The last field may take multiple (in some very insane cases, even 20 different
3232 additional) files. This might sound confusing at first. What the man pages call the
3233 <quote>LongPrinterName</quote> in reality should be called the <quote>Driver Name</quote>. You can name it
3234 anything you want, as long as you use this name later in the <command>rpcclient ... setdriver</command>
3235 command. For practical reasons, many name the driver the same as the printer.
3239 It isn't simple at all. I hear you asking: <quote>How do I know which files are Driver File</quote>,
3240 <quote>Data File</quote>, <quote>Config File</quote>, <quote>Help File</quote> and <quote>Language Monitor
3241 File in each case?</quote> For an answer, you may want to have a look at how a Windows NT box with a shared
3242 printer presents the files to us. Remember that this whole procedure has to be developed by the Samba Team by
3243 listening to the traffic caused by Windows computers on the wire. We may as well turn to a Windows box now and
3244 access it from a UNIX workstation. We will query it with <command>rpcclient</command> to see what it tells us
3245 and try to understand the man page more clearly.
3250 <title>Producing an Example by Querying a Windows Box</title>
3253 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3254 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3255 We could run <command>rpcclient</command> with a <command>getdriver</command> or a
3256 <command>getprinter</command> subcommand (in level 3 verbosity) against it. Just sit down at a UNIX or Linux
3257 workstation with the Samba utilities installed, then type the following command:
3259 &rootprompt;<userinput>rpcclient -U'user%secret' NT-SERVER -c 'getdriver printername 3'</userinput>
3263 From the result it should become clear which is which. Here is an example from my installation:
3264 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3266 &rootprompt;<userinput>rpcclient -U'Danka%xxxx' W200xSERVER \
3267 -c'getdriver "DANKA InfoStream Virtual Printer" 3'</userinput>
3268 cmd = getdriver "DANKA InfoStream Virtual Printer" 3
3271 Printer Driver Info 3:
3273 Driver Name: [DANKA InfoStream]
3274 Architecture: [Windows NT x86]
3275 Driver Path: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRIPT.DLL]
3276 Datafile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\INFOSTRM.PPD]
3277 Configfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRPTUI.DLL]
3278 Helpfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRIPT.HLP]
3293 Some printer drivers list additional files under the label <parameter>Dependentfiles</parameter>, and these
3294 would go into the last field <parameter>ListOfFiles,Comma-separated</parameter>. For the CUPS PostScript
3295 drivers, we do not need any (nor would we for the Adobe PostScript driver); therefore, the field will get a
3296 <quote>NULL</quote> entry.
3301 <title>Requirements for adddriver and setdriver to Succeed</title>
3304 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3305 <indexterm><primary>cupsaddsmb</primary></indexterm>
3306 <indexterm><primary>setdriver</primary></indexterm>
3307 From the man page (and from the quoted output of <command>cupsaddsmb</command> above) it becomes clear that
3308 you need to have certain conditions in order to make the manual uploading and initializing of the driver files
3309 succeed. The two <command>rpcclient</command> subcommands (<command>adddriver</command> and
3310 <command>setdriver</command>) need to encounter the following preconditions to complete successfully:
3314 <listitem><para>You are connected as <smbconfoption name="printer admin"/> or root (this is
3315 <emphasis>not</emphasis> the <quote>Printer Operators</quote> group in NT, but the <emphasis>printer
3316 admin</emphasis> group as defined in the <smbconfsection name="[global]"/> section of &smb.conf;).
3319 <listitem><para>Copy all required driver files to <filename>\\SAMBA\print$\w32x86</filename> and
3320 <filename>\\SAMBA\print$\win40</filename> as appropriate. They will end up in the <quote>0</quote> respective
3321 <quote>2</quote> subdirectories later. For now, <emphasis>do not</emphasis> put them there; they'll be
3322 automatically used by the <command>adddriver</command> subcommand. (If you use <command>smbclient</command> to
3323 put the driver files into the share, note that you need to escape the <quote>$</quote>: <command>smbclient
3324 //sambaserver/print\$ -U root.</command>)</para></listitem>
3326 <listitem><para>The user you're connecting as must be able to write to
3327 the <smbconfsection name="[print$]"/> share and create
3328 subdirectories.</para></listitem>
3330 <listitem><para>The printer you are going to set up for the Windows
3331 clients needs to be installed in CUPS already.</para></listitem>
3334 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3335 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3336 The CUPS printer must be known to Samba; otherwise the <command>setdriver</command> subcommand fails with an
3337 NT_STATUS_UNSUCCESSFUL error. To check if the printer is known by Samba, you may use the
3338 <command>enumprinters</command> subcommand to <command>rpcclient</command>. A long-standing bug prevented a
3339 proper update of the printer list until every smbd process had received a SIGHUP or was restarted. Remember
3340 this in case you've created the CUPS printer just recently and encounter problems: try restarting Samba.
3346 <title>Manual Driver Installation in 15 Steps</title>
3349 We are going to install a printer driver now by manually executing all
3350 required commands. Because this may seem a rather complicated process at
3351 first, we go through the procedure step by step, explaining every
3352 single action item as it comes up.
3356 <title>Manual Driver Installation</title>
3359 <title>Install the printer on CUPS.</title>
3362 &rootprompt;<userinput>lpadmin -p mysmbtstprn -v socket://10.160.51.131:9100 -E \
3363 -P canonIR85.ppd</userinput>
3367 This installs a printer with the name <parameter>mysmbtstprn</parameter>
3368 to the CUPS system. The printer is accessed via a socket
3369 (a.k.a. JetDirect or Direct TCP/IP) connection. You need to be root
3375 <title>(Optional.) Check if the printer is recognized by Samba.</title>
3378 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3380 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'enumprinters' localhost \
3381 | grep -C2 mysmbtstprn</userinput>
3383 name:[\\kde-bitshop\mysmbtstprn]
3384 description:[\\kde-bitshop\mysmbtstprn,,mysmbtstprn]
3385 comment:[mysmbtstprn]
3390 This should show the printer in the list. If not, stop and restart the Samba daemon (smbd) or send a HUP signal:
3392 &rootprompt;<userinput>kill -HUP `pidof smbd`</userinput>
3394 Check again. Troubleshoot and repeat until successful. Note the <quote>empty</quote> field between the two
3395 commas in the <quote>description</quote> line. The driver name would appear here if there was one already. You
3396 need to know root's Samba password (as set by the <command>smbpasswd</command> command) for this step and most
3397 of the following steps. Alternatively, you can authenticate as one of the users from the <quote>write
3398 list</quote> as defined in &smb.conf; for <smbconfsection name="[print$]"/>.
3403 <title>(Optional.) Check if Samba knows a driver for the printer.</title>
3406 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3407 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3409 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2'\
3410 localhost | grep driver </userinput>
3414 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' \
3415 localhost | grep -C4 driv</userinput>
3417 servername:[\\kde-bitshop]
3418 printername:[\\kde-bitshop\mysmbtstprn]
3419 sharename:[mysmbtstprn]
3420 portname:[Samba Printer Port]
3422 comment:[mysmbtstprn]
3425 printprocessor:[winprint]
3427 &rootprompt;<userinput>rpcclient -U root%xxxx -c 'getdriver mysmbtstprn' localhost</userinput>
3428 result was WERR_UNKNOWN_PRINTER_DRIVER
3432 None of the three commands shown above should show a driver.
3433 This step was done for the purpose of demonstrating this condition. An
3434 attempt to connect to the printer at this stage will prompt a
3435 message along the lines of, <quote>The server does not have the required printer
3436 driver installed.</quote>
3441 <title>Put all required driver files into Samba's
3445 &rootprompt;<userinput>smbclient //localhost/print\$ -U 'root%xxxx' \
3447 put /etc/cups/ppd/mysmbtstprn.ppd mysmbtstprn.PPD; \
3448 put /usr/share/cups/drivers/cupsui.dll cupsui.dll; \
3449 put /usr/share/cups/drivers/cupsdrvr.dll cupsdrvr.dll; \
3450 put /usr/share/cups/drivers/cups.hlp cups.hlp'</userinput>
3454 (This command should be entered in one long single line. Line breaks and the line ends indicated by
3455 <quote>\</quote> have been inserted for readability reasons.) This step is <emphasis>required</emphasis> for
3456 the next one to succeed. It makes the driver files physically present in the <smbconfsection name="[print$]"/>
3457 share. However, clients would still not be able to install them, because Samba does not yet treat them as
3458 driver files. A client asking for the driver would still be presented with a <quote>not installed here</quote>
3464 <title>Verify where the driver files are now.</title>
3467 &rootprompt;<userinput>ls -l /etc/samba/drivers/W32X86/</userinput>
3469 drwxr-sr-x 2 root ntadmin 532 May 25 23:08 2
3470 drwxr-sr-x 2 root ntadmin 670 May 16 03:15 3
3471 -rwxr--r-- 1 root ntadmin 14234 May 25 23:21 cups.hlp
3472 -rwxr--r-- 1 root ntadmin 278380 May 25 23:21 cupsdrvr.dll
3473 -rwxr--r-- 1 root ntadmin 215848 May 25 23:21 cupsui.dll
3474 -rwxr--r-- 1 root ntadmin 169458 May 25 23:21 mysmbtstprn.PPD
3478 The driver files now are in the W32X86 architecture <quote>root</quote> of
3479 <smbconfsection name="[print$]"/>.
3484 <title>Tell Samba that these are driver files (<command>adddriver</command>).</title>
3487 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3489 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" \
3490 "mydrivername:cupsdrvr.dll:mysmbtstprn.PPD: \
3491 cupsui.dll:cups.hlp:NULL:RAW:NULL"' \
3492 localhost</userinput>
3493 Printer Driver mydrivername successfully installed.
3497 You cannot repeat this step if it fails. It could fail even as a result of a simple typo. It will most likely
3498 have moved a part of the driver files into the <quote>2</quote> subdirectory. If this step fails, you need to
3499 go back to the fourth step and repeat it before you can try this one again. In this step, you need to choose a
3500 name for your driver. It is normally a good idea to use the same name as is used for the printer name;
3501 however, in big installations you may use this driver for a number of printers that obviously have different
3502 names, so the name of the driver is not fixed.
3507 <title>Verify where the driver files are now.</title>
3510 &rootprompt;<userinput>ls -l /etc/samba/drivers/W32X86/</userinput>
3512 drwxr-sr-x 2 root ntadmin 532 May 25 23:22 2
3513 drwxr-sr-x 2 root ntadmin 670 May 16 03:15 3
3515 &rootprompt;<userinput>ls -l /etc/samba/drivers/W32X86/2</userinput>
3518 -rwxr--r-- 1 root ntadmin 14234 May 25 23:21 cups.hlp
3519 -rwxr--r-- 1 root ntadmin 278380 May 13 13:53 cupsdrvr.dll
3520 -rwxr--r-- 1 root ntadmin 215848 May 13 13:53 cupsui.dll
3521 -rwxr--r-- 1 root ntadmin 169458 May 25 23:21 mysmbtstprn.PPD
3525 Notice how step 6 also moved the driver files to the appropriate
3526 subdirectory. Compare this with the situation after step 5.
3531 <title>(Optional.) Verify if Samba now recognizes the driver.</title>
3534 <indexterm><primary>rpcclient</primary><secondary>enumdrivers</secondary></indexterm>
3536 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'enumdrivers 3' \
3537 localhost | grep -B2 -A5 mydrivername</userinput>
3538 Printer Driver Info 3:
3540 Driver Name: [mydrivername]
3541 Architecture: [Windows NT x86]
3542 Driver Path: [\\kde-bitshop\print$\W32X86\2\cupsdrvr.dll]
3543 Datafile: [\\kde-bitshop\print$\W32X86\2\mysmbtstprn.PPD]
3544 Configfile: [\\kde-bitshop\print$\W32X86\2\cupsui.dll]
3545 Helpfile: [\\kde-bitshop\print$\W32X86\2\cups.hlp]
3549 Remember, this command greps for the name you chose for the
3550 driver in step 6. This command must succeed before you can proceed.
3555 <title>Tell Samba which printer should use these driver files (<command>setdriver</command>).</title>
3558 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3560 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'setdriver mysmbtstprn mydrivername' \
3561 localhost</userinput>
3562 Successfully set mysmbtstprn to driver mydrivername
3566 Since you can bind any printer name (print queue) to any driver, this is a convenient way to set up many
3567 queues that use the same driver. You do not need to repeat all the previous steps for the setdriver command to
3568 succeed. The only preconditions are that <command>enumdrivers</command> must find the driver and
3569 <command>enumprinters</command> must find the printer.
3574 <title>(Optional) Verify if Samba has recognized this association.</title>
3577 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3578 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3579 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3581 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \
3582 | grep driver</userinput>
3583 drivername:[mydrivername]
3585 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \
3586 | grep -C4 driv</userinput>
3587 servername:[\\kde-bitshop]
3588 printername:[\\kde-bitshop\mysmbtstprn]
3589 sharename:[mysmbtstprn]
3591 drivername:[mydrivername]
3592 comment:[mysmbtstprn]
3595 printprocessor:[winprint]
3597 &rootprompt;<userinput>rpcclient -U root%xxxx -c 'getdriver mysmbtstprn' localhost</userinput>
3599 Printer Driver Info 3:
3601 Driver Name: [mydrivername]
3602 Architecture: [Windows NT x86]
3603 Driver Path: [\\kde-bitshop\print$\W32X86\2\cupsdrvr.dll]
3604 Datafile: [\\kde-bitshop\print$\W32X86\2\mysmbtstprn.PPD]
3605 Configfile: [\\kde-bitshop\print$\W32X86\2\cupsui.dll]
3606 Helpfile: [\\kde-bitshop\print$\W32X86\2\cups.hlp]
3608 Defaultdatatype: [RAW]
3610 Defaultdatatype: [RAW]
3612 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'enumprinters' localhost \
3613 | grep mysmbtstprn</userinput>
3614 name:[\\kde-bitshop\mysmbtstprn]
3615 description:[\\kde-bitshop\mysmbtstprn,mydrivername,mysmbtstprn]
3616 comment:[mysmbtstprn]
3621 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3622 Compare these results with the ones from steps 2 and 3. Every one of these commands show the driver is installed. Even
3623 the <command>enumprinters</command> command now lists the driver
3624 on the <quote>description</quote> line.
3629 <title>(Optional.) Tickle the driver into a correct
3630 device mode.</title>
3633 <indexterm><primary>"Printers" folder</primary></indexterm>
3634 You certainly know how to install the driver on the client. In case
3635 you are not particularly familiar with Windows, here is a short
3636 recipe: Browse the Network Neighborhood, go to the Samba server, and look
3637 for the shares. You should see all shared Samba printers.
3638 Double-click on the one in question. The driver should get
3639 installed and the network connection set up. Another way is to
3640 open the <guilabel>Printers (and Faxes)</guilabel> folder, right-click on the printer in
3641 question, and select <guilabel>Connect</guilabel> or <guilabel>Install</guilabel>. As a result, a new printer
3642 should appear in your client's local <guilabel>Printers (and Faxes)</guilabel>
3643 folder, named something like <guilabel>printersharename on Sambahostname</guilabel>.
3647 It is important that you execute this step as a Samba printer admin
3648 (as defined in &smb.conf;). Here is another method
3649 to do this on Windows XP. It uses a command line, which you may type
3650 into the <quote>DOS box</quote> (type root's smbpassword when prompted):
3654 &dosprompt;<userinput>runas /netonly /user:root "rundll32 printui.dll,PrintUIEntry \
3655 /in /n \\sambaserver\mysmbtstprn"</userinput>
3659 Change any printer setting once (like changing <emphasis><guilabel>portrait</guilabel> to
3660 <guilabel>landscape</guilabel></emphasis>), click on <guibutton>Apply</guibutton>, and change the setting back.
3665 <title>Install the printer on a client (Point'n'Print).</title>
3668 <indexterm significance="preferred"><primary>point 'n' print</primary></indexterm>
3670 &dosprompt;<userinput>rundll32 printui.dll,PrintUIEntry /in /n "\\sambaserver\mysmbtstprn"</userinput>
3672 If it does not work, it could be a permissions problem with the <smbconfsection name="[print$]"/> share.
3677 <title>(Optional) Print a test page.</title>
3679 <indexterm><primary>rundll32</primary></indexterm>
3681 &dosprompt;<userinput>rundll32 printui.dll,PrintUIEntry /p /n "\\sambaserver\mysmbtstprn"</userinput>
3685 Then hit [TAB] five times, [ENTER] twice, [TAB] once, and [ENTER] again, and march to the printer.
3690 <title>(Recommended.) Study the test page.</title>
3693 Hmmm. Just kidding! By now you know everything about printer installations and you do not need to read a word.
3694 Just put it in a frame and bolt it to the wall with the heading "MY FIRST RPCCLIENT-INSTALLED PRINTER"
3695 &smbmdash; why not just throw it away!
3700 <title>(Obligatory.) Enjoy. Jump. Celebrate your success.</title>
3703 &rootprompt;<userinput>echo "Cheeeeerioooooo! Success..." >> /var/log/samba/log.smbd</userinput>
3710 <title>Troubleshooting Revisited</title>
3713 <indexterm><primary>adddriver</primary></indexterm>
3714 The setdriver command will fail if in Samba's mind the queue is not
3715 already there. A successful installation displays the promising message that the:
3717 Printer Driver ABC successfully installed.
3719 following the <command>adddriver</command> parts of the procedure. But you may also see
3720 a disappointing message like this one:
3722 result was NT_STATUS_UNSUCCESSFUL
3723 </computeroutput></para>
3726 <indexterm><primary>lpstat</primary></indexterm>
3727 <indexterm><primary>rpcclient</primary></indexterm>
3728 It is not good enough that you can see the queue in CUPS, using the <command>lpstat -p ir85wm</command>
3729 command. A bug in most recent versions of Samba prevents the proper update of the queue list. The recognition
3730 of newly installed CUPS printers fails unless you restart Samba or send a HUP to all smbd processes. To verify
3731 if this is the reason why Samba does not execute the <command>setdriver</command> command successfully, check
3732 if Samba <quote>sees</quote> the printer:
3733 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3735 &rootprompt;<userinput>rpcclient transmeta -N -U'root%xxxx' -c 'enumprinters 0'|grep ir85wm</userinput>
3736 printername:[ir85wm]
3740 An alternate command could be this:
3741 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3743 &rootprompt;<userinput>rpcclient transmeta -N -U'root%secret' -c 'getprinter ir85wm' </userinput>
3744 cmd = getprinter ir85wm
3746 name:[\\transmeta\ir85wm]
3747 description:[\\transmeta\ir85wm,ir85wm,DPD]
3748 comment:[CUPS PostScript-Treiber for Windows NT/200x/XP]
3752 By the way, you can use these commands, plus a few more, of course, to install drivers on remote Windows NT print servers too!
3758 <title>The Printing <filename>*.tdb</filename> Files</title>
3761 <indexterm><primary>TDB</primary></indexterm>
3762 <indexterm><primary>connections.tdb</primary><seealso>TDB</seealso></indexterm>
3763 <indexterm><primary>printing.tdb</primary><seealso>TDB</seealso></indexterm>
3764 <indexterm><primary>share_info.tdb</primary><seealso>TDB</seealso></indexterm>
3765 <indexterm><primary>ntdrivers.tdb</primary><seealso>TDB</seealso></indexterm>
3766 <indexterm><primary>unexpected.tdb</primary><seealso>TDB</seealso></indexterm>
3767 <indexterm><primary>brlock.tdb</primary><seealso>TDB</seealso></indexterm>
3768 <indexterm><primary>locking.tdb</primary><seealso>TDB</seealso></indexterm>
3769 <indexterm><primary>ntforms.tdb</primary><seealso>TDB</seealso></indexterm>
3770 <indexterm><primary>messages.tdb</primary><seealso>TDB</seealso></indexterm>
3771 <indexterm><primary>ntprinters.tdb</primary><seealso>TDB</seealso></indexterm>
3772 <indexterm><primary>sessionid.tdb</primary><seealso>TDB</seealso></indexterm>
3773 <indexterm><primary>secrets.tdb</primary><seealso>TDB</seealso></indexterm>
3774 Some mystery is associated with the series of files with a tdb suffix appearing in every Samba installation.
3775 They are <filename>connections.tdb</filename>, <filename>printing.tdb</filename>,
3776 <filename>share_info.tdb</filename>, <filename>ntdrivers.tdb</filename>, <filename>unexpected.tdb</filename>,
3777 <filename>brlock.tdb</filename>, <filename>locking.tdb</filename>, <filename>ntforms.tdb</filename>,
3778 <filename>messages.tdb</filename> , <filename>ntprinters.tdb</filename>, <filename>sessionid.tdb</filename>,
3779 and <filename>secrets.tdb</filename>. What is their purpose?
3783 <title>Trivial Database Files</title>
3786 <indexterm><primary>TDB</primary></indexterm>
3787 A Windows NT (print) server keeps track of all information needed to serve its duty toward its clients by
3788 storing entries in the Windows registry. Client queries are answered by reading from the registry,
3789 Administrator or user configuration settings that are saved by writing into the registry. Samba and UNIX
3790 obviously do not have such a Registry. Samba instead keeps track of all client-related information in a series
3791 of <filename>*.tdb</filename> files. (TDB stands for trivial data base). These are often located in
3792 <filename>/var/lib/samba/</filename> or <filename>/var/lock/samba/</filename>. The printing-related files are
3793 <filename>ntprinters.tdb</filename>, <filename>printing.tdb</filename>,<filename>ntforms.tdb</filename>, and
3794 <filename>ntdrivers.tdb</filename>.
3799 <title>Binary Format</title>
3802 <filename>*.tdb</filename> files are not human readable. They are written in a binary format. <quote>Why not
3803 ASCII?</quote>, you may ask. <quote>After all, ASCII configuration files are a good and proven tradition on
3804 UNIX.</quote> The reason for this design decision by the Samba Team is mainly performance. Samba needs to be
3805 fast; it runs a separate <command>smbd</command> process for each client connection, in some environments many
3806 thousands of them. Some of these <command>smbds</command> might need to write-access the same
3807 <filename>*.tdb</filename> file <emphasis>at the same time</emphasis>. The file format of Samba's
3808 <filename>*.tdb</filename> files allows for this provision. Many smbd processes may write to the same
3809 <filename>*.tdb</filename> file at the same time. This wouldn't be possible with pure ASCII files.
3814 <title>Losing <filename>*.tdb</filename> Files</title>
3817 It is very important that all <filename>*.tdb</filename> files remain consistent over all write and read
3818 accesses. However, it may happen that these files <emphasis>do</emphasis> get corrupted. (A <command>kill -9
3819 `pidof smbd'</command> while a write access is in progress could do the damage, as could a power interruption,
3820 etc.). In cases of trouble, a deletion of the old printing-related <filename>*.tdb</filename> files may be the
3821 only option. After that, you need to re-create all print-related setups unless you have made a backup of the
3822 <filename>*.tdb</filename> files in time.
3827 <title>Using <command>tdbbackup</command></title>
3830 <indexterm><primary>TDB</primary><secondary>backing up</secondary><see>tdbbackup</see></indexterm>
3831 <indexterm><primary>tdbbackup</primary></indexterm>
3832 Samba ships with a little utility that helps the root user of your system to backup your
3833 <filename>*.tdb</filename> files. If you run it with no argument, it prints a usage message:
3835 &rootprompt;<userinput>tdbbackup</userinput>
3836 Usage: tdbbackup [options] <fname...>
3839 -h this help message
3840 -s suffix set the backup suffix
3841 -v verify mode (restore if corrupt)
3845 Here is how I backed up my <filename>printing.tdb</filename> file:
3849 &rootprompt;<userinput>ls</userinput>
3850 . browse.dat locking.tdb ntdrivers.tdb printing.tdb
3851 .. share_info.tdb connections.tdb messages.tdb ntforms.tdb
3852 printing.tdbkp unexpected.tdb brlock.tdb gmon.out namelist.debug
3853 ntprinters.tdb sessionid.tdb
3855 &rootprompt;<userinput>tdbbackup -s .bak printing.tdb</userinput>
3856 printing.tdb : 135 records
3858 &rootprompt;<userinput>ls -l printing.tdb*</userinput>
3859 -rw------- 1 root root 40960 May 2 03:44 printing.tdb
3860 -rw------- 1 root root 40960 May 2 03:44 printing.tdb.bak
3867 <title>CUPS Print Drivers from Linuxprinting.org</title>
3870 <indexterm><primary>Linuxprinting.org</primary></indexterm>
3871 CUPS ships with good support for HP LaserJet-type printers. You can install the generic driver as follows:
3872 <indexterm><primary>lpadmin</primary></indexterm>
3874 &rootprompt;<userinput>lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -m laserjet.ppd</userinput>
3878 The <option>-m</option> switch will retrieve the <filename>laserjet.ppd</filename> from the standard
3879 repository for not-yet-installed PPDs, which CUPS typically stores in
3880 <filename>/usr/share/cups/model</filename>. Alternatively, you may use <option>-P /path/to/your.ppd</option>.
3884 The generic <filename>laserjet.ppd,</filename> however, does not support every special option for every
3885 LaserJet-compatible model. It constitutes a sort of <quote>least common denominator</quote> of all the models.
3886 If for some reason you must pay for the commercially available ESP Print Pro drivers, your first move should
3887 be to consult the database on the <ulink noescape="1"
3888 url="http://www.linuxprinting.org/printer_list.cgi">Linuxprinting</ulink> Web site. Linuxprinting.org has
3889 excellent recommendations about which driver is best used for each printer. Its database is kept current by
3890 the tireless work of Till Kamppeter from Mandrakesoft, who is also the principal author of the
3891 <command>foomatic-rip</command> utility.
3895 <indexterm><primary>foomatic-rip</primary></indexterm>
3896 <indexterm><primary>cupsomatic</primary></indexterm>
3897 <indexterm><primary>Adobe PPD</primary></indexterm>
3898 The former <command>cupsomatic</command> concept is now being replaced by the new successor, a much more
3899 powerful <command>foomatic-rip</command>. <command>cupsomatic</command> is no longer maintained. Here is the
3900 new URL to the <ulink noescape="1" url="http://www.linuxprinting.org/driver_list.cgi">Foomatic-3.0</ulink>
3901 database. If you upgrade to <command>foomatic-rip</command>, remember to also upgrade to the new-style PPDs
3902 for your Foomatic-driven printers. foomatic-rip will not work with PPDs generated for the old
3903 <command>cupsomatic</command>. The new-style PPDs are 100% compliant with the Adobe PPD specification. They
3904 are also intended to be used by Samba and the cupsaddsmb utility, to provide the driver files for the Windows
3909 <title>foomatic-rip and Foomatic Explained</title>
3913 <indexterm significance="preferred"><primary>foomatic</primary></indexterm>
3914 <indexterm significance="preferred"><primary>foomatic-rip</primary></indexterm>
3915 Nowadays, most Linux distributions rely on the utilities from the <ulink
3916 url="http://www.linuxprinting.org/">Linuxprinting.org</ulink> to create their printing-related software
3917 (which, by the way, works on all UNIXes and on Mac OS X and Darwin, too). The utilities from this sire have a
3918 very end-user-friendly interface that allows for an easy update of drivers and PPDs for all supported models,
3919 all spoolers, all operating systems, and all package formats (because there is none). Its history goes back a
3924 Recently, Foomatic has achieved the astonishing milestone of <ulink
3925 url="http://www.linuxprinting.org/printer_list.cgi?make=Anyone">1,000 listed</ulink> printer models.
3926 Linuxprinting.org keeps all the important facts about printer drivers, supported models, and which options are
3927 available for the various driver/printer combinations in its <ulink
3928 url="http://www.linuxprinting.org/foomatic.html">Foomatic</ulink> database. Currently there are <ulink
3929 url="http://www.linuxprinting.org/driver_list.cgi">245 drivers</ulink> in the database. Many drivers support
3930 various models, and many models may be driven by different drivers &smbmdash; its your choice!
3934 <title>690 <quote>Perfect</quote> Printers</title>
3937 <indexterm><primary>Windows PPD</primary></indexterm>
3938 At present, there are 690 devices dubbed as working perfectly: 181 are <emphasis>mostly</emphasis> perfect, 96
3939 are <emphasis>partially</emphasis> perfect, and 46 are paperweights. Keeping in mind that most of these are
3940 non-PostScript models (PostScript printers are automatically supported by CUPS to perfection by using their
3941 own manufacturer-provided Windows PPD), and that a multifunctional device never qualifies as working perfectly
3942 if it does not also scan and copy and fax under GNU/Linux &smbmdash; then this is a truly astonishing
3943 achievement! Three years ago the number was not more than 500, and Linux or UNIX printing at the time wasn't
3944 anywhere near the quality it is today.
3949 <title>How the Printing HOWTO Started It All</title>
3952 A few years ago <ulink url="http://www2.picante.com/">Grant Taylor</ulink> started it all. The
3953 roots of today's Linuxprinting.org are in the first <ulink
3954 url="http://www.linuxprinting.org/foomatic2.9/howto/">Linux Printing HOWTO</ulink> that he authored. As a
3955 side-project to this document, which served many Linux users and admins to guide their first steps in this
3956 complicated and delicate setup (to a scientist, printing is <quote>applying a structured deposition of
3957 distinct patterns of ink or toner particles on paper substrates</quote>), he started to build in a little
3958 Postgres database with information about the hardware and driver zoo that made up Linux printing of the time.
3959 This database became the core component of today's Foomatic collection of tools and data. In the meantime, it
3960 has moved to an XML representation of the data.
3965 <title>Foomatic's Strange Name</title>
3969 <indexterm><primary>foomatic</primary></indexterm>
3970 <quote>Why the funny name?</quote> you ask. When it really took off, around spring 2000, CUPS was far less
3971 popular than today, and most systems used LPD, LPRng, or even PDQ to print. CUPS shipped with a few generic
3972 drivers (good for a few hundred different printer models). These didn't support many device-specific options.
3973 CUPS also shipped with its own built-in rasterization filter (<parameter>pstoraster</parameter>, derived from
3974 Ghostscript). On the other hand, CUPS provided brilliant support for <emphasis>controlling</emphasis> all
3975 printer options through standardized and well-defined PPD files. Plus, CUPS was designed to be easily
3980 Taylor already had in his database a respectable compilation of facts about many more printers and the
3981 Ghostscript <quote>drivers</quote> they run with. His idea, to generate PPDs from the database information and
3982 use them to make standard Ghostscript filters work within CUPS, proved to work very well. It also killed
3983 several birds with one stone:
3987 <listitem><para>It made all current and future Ghostscript filter
3988 developments available for CUPS.</para></listitem>
3990 <listitem><para>It made available a lot of additional printer models
3991 to CUPS users (because often the traditional Ghostscript way of
3992 printing was the only one available).</para></listitem>
3994 <listitem><para>It gave all the advanced CUPS options (Web interface,
3995 GUI driver configurations) to users wanting (or needing) to use
3996 Ghostscript filters.</para></listitem>
4001 <title>cupsomatic, pdqomatic, lpdomatic, directomatic</title>
4004 <indexterm><primary>cupsomatic</primary></indexterm>
4005 <indexterm><primary>CUPS-PPD</primary></indexterm>
4006 <indexterm><primary>PPD</primary><secondary>CUPS</secondary><see>CUPS-PPD</see></indexterm>
4007 CUPS worked through a quickly hacked-up filter script named <ulink
4008 url="http://www.linuxprinting.org/download.cgi?filename=cupsomatic&show=0">cupsomatic</ulink>. cupsomatic
4009 ran the printfile through Ghostscript, constructing automatically the rather complicated command line needed.
4010 It just needed to be copied into the CUPS system to make it work. To configure the way cupsomatic controls the
4011 Ghostscript rendering process, it needs a CUPS-PPD. This PPD is generated directly from the contents of the
4012 database. For CUPS and the respective printer/filter combo, another Perl script named CUPS-O-Matic did the PPD
4013 generation. After that was working, Taylor implemented within a few days a similar thing for two other
4014 spoolers. Names chosen for the config-generator scripts were <ulink
4015 url="http://www.linuxprinting.org/download.cgi?filename=lpdomatic&show=0">PDQ-O-Matic</ulink> (for PDQ)
4016 and <ulink url="http://www.linuxprinting.org/download.cgi?filename=lpdomatic&show=0">LPD-O-Matic</ulink>
4017 (for &smbmdash; you guessed it &smbmdash; LPD); the configuration here didn't use PPDs but other
4018 spooler-specific files.
4022 From late summer of that year, <ulink url="http://www.linuxprinting.org/till/">Till Kamppeter</ulink> started
4023 to put work into the database. Kamppeter had been newly employed by <ulink
4024 url="http://www.mandrakesoft.com/">Mandrakesoft</ulink> to convert its printing system over to CUPS, after
4025 they had seen his <ulink url="http://www.fltk.org/">FLTK</ulink>-based <ulink
4026 url="http://cups.sourceforge.net/xpp/">XPP</ulink> (a GUI front-end to the CUPS lp-command). He added a huge
4027 amount of new information and new printers. He also developed the support for other spoolers, like <ulink
4028 url="http://ppr.sourceforge.net/">PPR</ulink> (via ppromatic), <ulink
4029 url="http://sourceforge.net/projects/lpr/">GNUlpr</ulink>, and <ulink
4030 url="http://www.lprng.org/">LPRng</ulink> (both via an extended lpdomatic) and spooler-less printing (<ulink
4031 url="http://www.linuxprinting.org/download.cgi?filename=directomatic&show=0">directomatic</ulink>).
4035 So, to answer your question, <quote>Foomatic</quote> is the general name for all the overlapping code and data
4036 behind the <quote>*omatic</quote> scripts. Foomatic, up to versions 2.0.x, required (ugly) Perl data
4037 structures attached to Linuxprinting.org PPDs for CUPS. It had a different <quote>*omatic</quote> script for
4038 every spooler, as well as different printer configuration files.
4043 <title>The <emphasis>Grand Unification</emphasis> Achieved</title>
4046 <indexterm><primary>foomatic-rip</primary></indexterm>
4047 This has all changed in Foomatic versions 2.9 (beta) and released as <quote>stable</quote> 3.0. It has now
4048 achieved the convergence of all *omatic scripts and is called the <ulink
4049 url="http://www.linuxprinting.org/foomatic2.9/download.cgi?filename=foomatic-rip&show=0">foomatic-rip</ulink>.
4050 This single script is the unification of the previously different spooler-specific *omatic scripts.
4051 foomatic-rip is used by all the different spoolers alike, and because it can read PPDs (both the original
4052 PostScript printer PPDs and the Linuxprinting.org-generated ones), all of a sudden all supported spoolers can
4053 have the power of PPDs at their disposal. Users only need to plug foomatic-rip into their system. For users
4054 there is improved media type and source support &smbmdash; paper sizes and trays are easier to configure.
4058 <indexterm><primary>PPDs</primary></indexterm>
4059 <indexterm><primary>Foomatic tutorial</primary></indexterm>
4060 <indexterm><primary>LinuxKongress2002</primary></indexterm>
4061 Also, the new generation of Linuxprinting.org PPDs no longer contains Perl data structures. If you are a
4062 distro maintainer and have used the previous version of Foomatic, you may want to give the new one a spin, but
4063 remember to generate a new-version set of PPDs via the new <ulink
4064 url="http://www.linuxprinting.org/download/foomatic/foomatic-db-engine-3.0.0beta1.tar.gz">foomatic-db-engine!</ulink>.
4065 Individual users just need to generate a single new PPD specific to their model by <ulink
4066 url="http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/II.Foomatic-User/II.tutorial-handout-foomatic-user.html">following
4067 the steps</ulink> outlined in the Foomatic tutorial or in this chapter. This new development is truly amazing.
4071 <indexterm><primary>foomatic-rip</primary></indexterm>
4072 <indexterm><primary>Adobe</primary></indexterm>
4073 <indexterm><primary>printer drivers</primary></indexterm>
4074 foomatic-rip is a very clever wrapper around the need to run Ghostscript with a different syntax, options,
4075 device selections, and/or filters for each different printer or spooler. At the same time, it can read the PPD
4076 associated with a print queue and modify the print job according to the user selections. Together with this
4077 comes the 100% compliance of the new Foomatic PPDs with the Adobe spec. Some innovative features of the
4078 Foomatic concept may surprise users. It will support custom paper sizes for many printers and will support
4079 printing on media drawn from different paper trays within the same job (in both cases, even where there is no
4080 support for this from Windows-based vendor printer drivers).
4085 <title>Driver Development Outside</title>
4088 <indexterm><primary>Linuxprinting.org</primary></indexterm>
4089 Most driver development itself does not happen within Linuxprinting.org. Drivers are written by independent
4090 maintainers. Linuxprinting.org just pools all the information and stores it in its database. In addition, it
4091 also provides the Foomatic glue to integrate the many drivers into any modern (or legacy) printing system
4096 Speaking of the different driver development groups, most of the work is currently done in three projects:
4101 <indexterm><primary>Omni</primary></indexterm>
4102 <ulink url="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/">Omni</ulink>
4103 &smbmdash; a free software project by IBM that tries to convert its printer
4104 driver knowledge from good-ol' OS/2 times into a modern, modular,
4105 universal driver architecture for Linux/UNIX (still beta). This
4106 currently supports 437 models.</para></listitem>
4109 <indexterm><primary>HPIJS</primary></indexterm>
4110 <ulink url="http://hpinkjet.sf.net/">HPIJS</ulink> &smbmdash;
4111 a free software project by HP to provide the support for its own
4112 range of models (very mature, printing in most cases is perfect and
4113 provides true photo quality). This currently supports 369
4114 models.</para></listitem>
4117 <indexterm><primary>Gutenprint</primary></indexterm>
4118 <ulink url="http://gimp-print.sourceforge.net/">Gutenprint</ulink> &smbmdash; a free software
4119 effort, started by Michael Sweet (also lead developer for CUPS), now
4120 directed by Robert Krawitz, which has achieved an amazing level of
4121 photo print quality (many Epson users swear that its quality is
4122 better than the vendor drivers provided by Epson for the Microsoft
4123 platforms). This currently supports 522 models.</para></listitem>
4128 <title>Forums, Downloads, Tutorials, Howtos (Also for Mac OS X and Commercial UNIX)</title>
4131 Linuxprinting.org today is the one-stop shop to download printer drivers. Look for printer information and
4132 <ulink url="http://www.linuxprinting.org//kpfeifle/LinuxKongress2002/Tutorial/">tutorials</ulink> or solve
4133 printing problems in its popular <ulink url="http://www.linuxprinting.org/newsportal/">forums</ulink>. This
4134 forum is not just for GNU/Linux users, but admins of <ulink url="http://www.linuxprinting.org/macosx/">
4135 commercial UNIX systems</ulink> are also going there, and the relatively new
4136 <ulink url="http://www.linuxprinting.org/newsportal/thread.php3?name=linuxprinting.macosx.general">Mac OS X
4137 forum</ulink> has turned out to be one of the most frequented forums after only a few weeks.
4141 <indexterm><primary>Mandriva</primary></indexterm>
4142 <indexterm><primary>Mandrake</primary></indexterm>
4143 <indexterm><primary>Conectiva</primary></indexterm>
4144 Linuxprinting.org and the Foomatic driver wrappers around Ghostscript are now a standard tool-chain for
4145 printing on all the important distros. Most of them also have CUPS underneath. While in recent years most
4146 printer data had been added by Kamppeter, many additional contributions came from engineers with SuSE, Red
4147 Hat, Conectiva, Debian, and others. Vendor-neutrality is an important goal of the Foomatic project. Mandrake
4148 and Conectiva have merged and are now called Mandriva.
4152 Till Kamppeter from Mandrakesoft is doing an excellent job in his spare time to maintain Linuxprinting.org and
4153 Foomatic. So if you use it often, please send him a note showing your appreciation.
4158 <title>Foomatic Database-Generated PPDs</title>
4161 <indexterm><primary>Foomatic database</primary></indexterm>
4162 <indexterm><primary>XML-based datasets</primary></indexterm>
4163 <indexterm><primary>kprinter</primary></indexterm>
4164 <indexterm><primary>gtklp</primary></indexterm>
4165 <indexterm><primary>xpp</primary></indexterm>
4166 <indexterm><primary>HP Photosmart</primary></indexterm>
4167 <indexterm><primary>Epson Stylus inkjet</primary></indexterm>
4168 <indexterm><primary>non-PostScript printers</primary></indexterm>
4169 <indexterm><primary>raster</primary></indexterm>
4170 The Foomatic database is an amazing piece of ingenuity in itself. Not only does it keep the printer and driver
4171 information, but it is organized in a way that it can generate PPD files on the fly from its internal
4172 XML-based datasets. While these PPDs are modeled to the Adobe specification of PPDs, the
4173 Linuxprinting.org/Foomatic-PPDs do not normally drive PostScript printers. They are used to describe all the
4174 bells and whistles you could ring or blow on an Epson Stylus inkjet, or an HP Photosmart, or what-have-you.
4175 The main trick is one little additional line, not envisaged by the PPD specification, starting with the
4176 <parameter>*cupsFilter</parameter> keyword. It tells the CUPS daemon how to proceed with the PostScript print
4177 file (old-style Foomatic-PPDs named the cupsomatic filter script, while the new-style PPDs are now call
4178 foomatic-rip). This filter script calls Ghostscript on the host system (the recommended variant is ESP
4179 Ghostscript) to do the rendering work. foomatic-rip knows which filter or internal device setting it should
4180 ask from Ghostscript to convert the PostScript print job into a raster format ready for the target device.
4181 This usage of PPDs to describe the options of non-PostScript printers was the invention of the CUPS
4182 developers. The rest is easy. GUI tools (like KDE's marvelous <ulink
4183 url="http://printing.kde.org/overview/kprinter.phtml">kprinter</ulink> or the GNOME <ulink
4184 url="http://gtklp.sourceforge.net/">gtklp</ulink> xpp and the CUPS Web interface) read the PPD as well and use
4185 this information to present the available settings to the user as an intuitive menu selection.
4191 <title>foomatic-rip and Foomatic PPD Download and Installation</title>
4194 Here are the steps to install a foomatic-rip-driven LaserJet 4 Plus-compatible
4195 printer in CUPS (note that recent distributions of SuSE, UnitedLinux and
4196 Mandrake may ship with a complete package of Foomatic-PPDs plus the
4197 <command>foomatic-rip</command> utility. Going directly to
4198 Linuxprinting.org ensures that you get the latest driver/PPD files).
4202 <listitem><para>Open your browser at the Linuxprinting.org printer list <ulink url="http://www.linuxprinting.org/printer_list.cgi">page.</ulink>
4205 <listitem><para>Check the complete list of printers in the
4206 <ulink url="http://www.linuxprinting.org/printer_list.cgi?make=Anyone">database.</ulink>.
4209 <listitem><para>Select your model and click on the link.
4212 <listitem><para>You'll arrive at a page listing all drivers working with this
4213 model (for all printers, there will always be <emphasis>one</emphasis>
4214 recommended driver. Try this one first).
4217 <listitem><para>In our case (HP LaserJet 4 Plus), we'll arrive at the default driver for the
4218 <ulink url="http://www.linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_4_Plus">HP-LaserJet 4 Plus.</ulink>
4221 <listitem><para>The recommended driver is ljet4.</para></listitem>
4223 <listitem><para>Several links are provided here. You should visit them all if you
4224 are not familiar with the Linuxprinting.org database.
4227 <listitem><para>There is a link to the database page for the
4228 <ulink url="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4">ljet4</ulink>.
4229 On the driver's page, you'll find important and detailed information
4230 about how to use that driver within the various available
4231 spoolers.</para></listitem>
4233 <listitem><para>Another link may lead you to the home page of the
4234 author of the driver.</para></listitem>
4236 <listitem><para>Important links are the ones that provide hints with
4237 setup instructions for <ulink noescape="1" url="http://www.linuxprinting.org/cups-doc.html">CUPS</ulink>;
4238 <ulink url="http://www.linuxprinting.org/pdq-doc.html">PDQ</ulink>;
4239 <ulink url="http://www.linuxprinting.org/lpd-doc.html">LPD, LPRng, and GNUlpr</ulink>);
4240 as well as <ulink url="http://www.linuxprinting.org/ppr-doc.html">PPR</ulink>
4241 or <quote>spoolerless</quote> <ulink url="http://www.linuxprinting.org/direct-doc.html">printing</ulink>.
4244 <listitem><para>You can view the PPD in your browser through this link:
4245 <ulink noescape="1" url="http://www.linuxprinting.org/ppd-o-matic.cgi?driver=ljet4&printer=HP-LaserJet_4_Plus&show=1">http://www.linuxprinting.org/ppd-o-matic.cgi?driver=ljet4&printer=HP-LaserJet_4_Plus&show=1</ulink>
4246 </para></listitem> <listitem><para>Most importantly, you can also generate and download
4247 the <ulink url="http://www.linuxprinting.org/ppd-o-matic.cgi?driver=ljet4&printer=HP-LaserJet_4_Plus&show=0">PPD</ulink>.
4250 <listitem><para>The PPD contains all the information needed to use our
4251 model and the driver; once installed, this works transparently
4252 for the user. Later you'll only need to choose resolution, paper size,
4253 and so on, from the Web-based menu, or from the print dialog GUI, or from
4254 the command line.</para></listitem>
4256 <listitem><para>If you ended up on the drivers
4257 <ulink url="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4">page</ulink>,
4258 you can choose to use the <quote>PPD-O-Matic</quote> online PPD generator
4259 program.</para></listitem>
4261 <listitem><para>Select the exact model and check either <guilabel>Download</guilabel> or
4262 <guilabel>Display PPD file</guilabel> and click <guilabel>Generate PPD file</guilabel>.</para></listitem>
4264 <listitem><para>If you save the PPD file from the browser view, please
4265 do not use cut and paste (since it could possibly damage line endings
4266 and tabs, which makes the PPD likely to fail its duty), but use <guimenuitem>Save
4267 as...</guimenuitem> in your browser's menu. (It is best to use the <guilabel>Download</guilabel> option
4268 directly from the Web page.)</para></listitem>
4270 <listitem><para>Another interesting part on each driver page is
4271 the <guimenuitem>Show execution details</guimenuitem> button. If you
4272 select your printer model and click on that button,
4273 a complete Ghostscript command line will be displayed, enumerating all options
4274 available for that combination of driver and printer model. This is a great way to
4275 <quote>learn Ghostscript by doing</quote>. It is also an excellent cheat sheet
4276 for all experienced users who need to reconstruct a good command line
4277 for that darned printing script, but can't remember the exact
4278 syntax. </para></listitem>
4280 <listitem><para>Sometime during your visit to Linuxprinting.org, save
4281 the PPD to a suitable place on your hard disk, say
4282 <filename>/path/to/my-printer.ppd</filename> (if you prefer to install
4283 your printers with the help of the CUPS Web interface, save the PPD to
4284 the <filename>/usr/share/cups/model/</filename> path and restart
4285 cupsd).</para></listitem>
4287 <listitem><para>Then install the printer with a suitable command line,
4292 &rootprompt;<userinput>lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E \
4293 -P path/to/my-printer.ppd</userinput>
4294 </screen></para></listitem>
4296 <listitem><para>For all the new-style <quote>Foomatic-PPDs</quote>
4297 from Linuxprinting.org, you also need a special CUPS filter named
4301 <listitem><para>The foomatic-rip Perl script itself also makes some
4302 interesting <ulink url="http://www.linuxprinting.org/foomatic2.9/download.cgi?filename=foomatic-rip&show=1">reading</ulink>
4303 because it is well documented by Kamppeter's in-line comments (even
4304 non-Perl hackers will learn quite a bit about printing by reading
4305 it).</para></listitem>
4307 <listitem><para>Save foomatic-rip either directly in
4308 <filename>/usr/lib/cups/filter/foomatic-rip</filename> or somewhere in
4309 your $PATH (and remember to make it world-executable). Again,
4310 do not save by copy and paste but use the appropriate link or the
4311 <guimenuitem>Save as...</guimenuitem> menu item in your browser.</para></listitem>
4313 <listitem><para>If you save foomatic-rip in your $PATH, create a symlink:
4315 &rootprompt;<userinput>cd /usr/lib/cups/filter/ ; ln -s `which foomatic-rip'</userinput>
4320 CUPS will discover this new available filter at startup after restarting
4321 cupsd.</para></listitem>
4325 Once you print to a print queue set up with the Foomatic PPD, CUPS will insert the appropriate commands and
4326 comments into the resulting PostScript job file. foomatic-rip is able to read and act upon these and uses some
4327 specially encoded Foomatic comments embedded in the job file. These in turn are used to construct
4328 (transparently for you, the user) the complicated Ghostscript command line telling the printer driver exactly
4329 how the resulting raster data should look and which printer commands to embed into the data stream. You need:
4333 <listitem><para>A <quote>foomatic+something</quote> PPD &smbmdash; but this is not enough
4334 to print with CUPS (it is only <emphasis>one</emphasis> important
4335 component).</para></listitem>
4337 <listitem><para>The <parameter>foomatic-rip</parameter> filter script (Perl) in
4338 <filename>/usr/lib/cups/filters/</filename>.</para></listitem>
4340 <listitem><para>Perl to make foomatic-rip run.</para></listitem>
4342 <listitem><para>Ghostscript (because it is doing the main work,
4343 controlled by the PPD/foomatic-rip combo) to produce the raster data
4344 fit for your printer model's consumption.</para></listitem>
4346 <listitem><para>Ghostscript <emphasis>must</emphasis> (depending on
4347 the driver/model) contain support for a certain device representing
4348 the selected driver for your model (as shown by <command>gs -h</command>).</para></listitem>
4350 <listitem><para>foomatic-rip needs a new version of PPDs (PPD versions
4351 produced for cupsomatic do not work with foomatic-rip).</para></listitem>
4357 <title>Page Accounting with CUPS</title>
4361 <indexterm><primary>CUPS</primary><secondary>Page Accounting</secondary></indexterm>
4362 Often there are questions regarding print quotas where Samba users (that is, Windows clients) should not be
4363 able to print beyond a certain number of pages or data volume per day, week, or month. This feature is
4364 dependent on the real print subsystem you're using. Samba's part is always to receive the job files from the
4365 clients (filtered <emphasis>or</emphasis> unfiltered) and hand them over to this printing subsystem.
4369 Of course one could hack things with one's own scripts. But then there is CUPS. CUPS supports quotas that can
4370 be based on the size of jobs or on the number of pages or both, and can span any time period you want.
4374 <title>Setting Up Quotas</title>
4377 <indexterm><primary>CUPS</primary><secondary>quotas</secondary></indexterm>
4378 This is an example command of how root would set a print quota in CUPS, assuming an existing printer named
4379 <quote>quotaprinter</quote>:
4380 <indexterm><primary>lpadmin</primary></indexterm>
4382 &rootprompt;<userinput>lpadmin -p quotaprinter -o job-quota-period=604800 \
4383 -o job-k-limit=1024 -o job-page-limit=100</userinput>
4387 This would limit every single user to print no more than 100 pages or 1024 KB of
4388 data (whichever comes first) within the last 604,800 seconds ( = 1 week).
4393 <title>Correct and Incorrect Accounting</title>
4396 For CUPS to count correctly, the printfile needs to pass the CUPS pstops filter; otherwise it uses a dummy
4397 count of <quote>one</quote>. Some print files do not pass it (e.g., image files), but then those are mostly
4398 one-page jobs anyway. This also means that proprietary drivers for the target printer running on the client
4399 computers and CUPS/Samba, which then spool these files as <quote>raw</quote> (i.e., leaving them untouched,
4400 not filtering them), will be counted as one-pagers too!
4404 You need to send PostScript from the clients (i.e., run a PostScript driver there) to have the chance to get
4405 accounting done. If the printer is a non-PostScript model, you need to let CUPS do the job to convert the file
4406 to a print-ready format for the target printer. This is currently working for about a thousand different
4407 printer models. Linuxprinting.org has a driver <ulink url="http://www.linuxprinting.org/printer_list.cgi">list</ulink>.
4412 <title>Adobe and CUPS PostScript Drivers for Windows Clients</title>
4415 <indexterm><primary>Adobe PostScript</primary></indexterm>
4416 <indexterm><primary>pstops</primary></indexterm>
4417 <indexterm><primary>PPD</primary></indexterm>
4418 <indexterm><primary>pstoraster</primary></indexterm>
4419 <indexterm><primary>PJL-header</primary></indexterm>
4420 Before CUPS 1.1.16, your only option was to use the Adobe PostScript driver on the Windows clients. The output
4421 of this driver was not always passed through the <command>pstops</command> filter on the CUPS/Samba side, and
4422 therefore was not counted correctly (the reason is that it often, depending on the PPD being used, wrote a
4423 PJL-header in front of the real PostScript, which caused CUPS to skip <command>pstops</command> and go
4424 directly to the <command>pstoraster</command> stage).
4428 From CUPS 1.1.16 and later releases, you can use the CUPS PostScript driver for Windows NT/200x/XP
4429 clients (which is tagged in the download area of <filename>http://www.cups.org/</filename> as the
4430 <filename>cups-samba-1.1.16.tar.gz</filename> package). It does <emphasis>not</emphasis> work for Windows
4431 9x/Me clients, but it guarantees:
4435 <listitem><para> <indexterm><primary>PJL</primary></indexterm> To not write a PJL-header.</para></listitem>
4437 <listitem><para>To still read and support all PJL-options named in the
4438 driver PPD with its own means.</para></listitem>
4440 <listitem><para>That the file will pass through the <command>pstops</command> filter
4441 on the CUPS/Samba server.</para></listitem>
4443 <listitem><para>To page-count correctly the print file.</para></listitem>
4447 You can read more about the setup of this combination in the man page for <command>cupsaddsmb</command> (which
4448 is only present with CUPS installed, and only current from CUPS 1.1.16).
4453 <title>The page_log File Syntax</title>
4456 <indexterm><primary>page_log</primary></indexterm>
4457 These are the items CUPS logs in the <filename>page_log</filename> for every page of a job:
4461 <listitem><para>Printer name</para></listitem>
4463 <listitem><para>User name</para></listitem>
4465 <listitem><para>Job ID</para></listitem>
4467 <listitem><para>Time of printing</para></listitem>
4469 <listitem><para>Page number</para></listitem>
4471 <listitem><para>Number of copies</para></listitem>
4473 <listitem><para>A billing information string (optional)</para></listitem>
4475 <listitem><para>The host that sent the job (included since version 1.1.19)</para></listitem>
4479 Here is an extract of my CUPS server's <filename>page_log</filename> file to illustrate the
4480 format and included items:
4484 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 1 3 #marketing 10.160.50.13
4485 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 2 3 #marketing 10.160.50.13
4486 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 3 3 #marketing 10.160.50.13
4487 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 4 3 #marketing 10.160.50.13
4488 Dig9110 boss 402 [22/Apr/2003:10:33:22 +0100] 1 440 finance-dep 10.160.51.33
4492 This was job ID <parameter>401</parameter>, printed on <parameter>tec_IS2027</parameter>
4493 by user <parameter>kurt</parameter>, a 64-page job printed in three copies, billed to
4494 <parameter>#marketing</parameter>, and sent from IP address <constant>10.160.50.13.</constant>
4495 The next job had ID <parameter>402</parameter>, was sent by user <parameter>boss</parameter>
4496 from IP address <constant>10.160.51.33</constant>, printed from one page 440 copies, and
4497 is set to be billed to <parameter>finance-dep</parameter>.
4502 <title>Possible Shortcomings</title>
4505 What flaws or shortcomings are there with this quota system?
4509 <listitem><para>The ones named above (wrongly logged job in case of
4510 printer hardware failure, and so on).</para></listitem>
4512 <listitem><para>In reality, CUPS counts the job pages that are being
4513 processed in <emphasis>software</emphasis> (that is, going through the
4514 RIP) rather than the physical sheets successfully leaving the
4515 printing device. Thus, if there is a jam while printing the fifth sheet out
4516 of 1,000 and the job is aborted by the printer, the page count will
4517 still show the figure of 1,000 for that job.</para></listitem>
4519 <listitem><para>All quotas are the same for all users (no flexibility
4520 to give the boss a higher quota than the clerk) and no support for
4521 groups.</para></listitem>
4523 <listitem><para>No means to read out the current balance or the
4524 <quote>used-up</quote> number of current quota.</para></listitem>
4526 <listitem><para>A user having used up 99 sheets of a 100 quota will
4527 still be able to send and print a 1,000 sheet job.</para></listitem>
4529 <listitem><para>A user being denied a job because of a filled-up quota
4530 does not get a meaningful error message from CUPS other than
4531 <quote>client-error-not-possible</quote>.</para></listitem>
4536 <title>Future Developments</title>
4539 This is the best system currently available, and there are huge
4540 improvements under development for CUPS 1.2:
4544 <listitem><para>Page counting will go into the backends (these talk
4545 directly to the printer and will increase the count in sync with the
4546 actual printing process; thus, a jam at the fifth sheet will lead to a
4547 stop in the counting).</para></listitem>
4549 <listitem><para>Quotas will be handled more flexibly.</para></listitem>
4551 <listitem><para>Probably there will be support for users to inquire
4552 about their accounts in advance.</para></listitem>
4554 <listitem><para>Probably there will be support for some other tools
4555 around this topic.</para></listitem>
4560 <title>Other Accounting Tools</title>
4563 Other accounting tools that can be used includes: PrintAnalyzer, pyKota, printbill, LogReport.
4564 For more information regarding these tools you can try a Google search.
4571 <title>Additional Material</title>
4574 A printer queue with <emphasis>no</emphasis> PPD associated to it is a
4575 <quote>raw</quote> printer, and all files will go directly there as received by the
4576 spooler. The exceptions are file types <parameter>application/octet-stream</parameter>
4577 that need the pass-through feature enabled. <quote>Raw</quote> queues do not do any
4578 filtering at all; they hand the file directly to the CUPS backend.
4579 This backend is responsible for sending the data to the device
4580 (as in the <quote>device URI</quote> notation: <filename>lpd://, socket://,
4581 smb://, ipp://, http://, parallel:/, serial:/, usb:/</filename>, and so on).
4585 cupsomatic/Foomatic are <emphasis>not</emphasis> native CUPS drivers
4586 and they do not ship with CUPS. They are a third-party add-on
4587 developed at Linuxprinting.org. As such, they are a brilliant hack to
4588 make all models (driven by Ghostscript drivers/filters in traditional
4589 spoolers) also work via CUPS, with the same (good or bad!) quality as
4590 in these other spoolers. <parameter>cupsomatic</parameter> is only a vehicle to execute a
4591 Ghostscript command line at that stage in the CUPS filtering chain
4592 where normally the native CUPS <parameter>pstoraster</parameter> filter would kick
4593 in. <parameter>cupsomatic</parameter> bypasses <parameter>pstoraster</parameter>, kidnaps the print file from CUPS,
4594 and redirects it to go through Ghostscript. CUPS accepts this
4595 because the associated cupsomatic/foomatic-PPD specifies:
4598 *cupsFilter: "application/vnd.cups-postscript 0 cupsomatic"
4601 This line persuades CUPS to hand the file to <parameter>cupsomatic</parameter> once it has
4602 successfully converted it to the MIME type
4603 <parameter>application/vnd.cups-postscript</parameter>. This conversion will not happen for
4604 jobs arriving from Windows that are autotyped
4605 <parameter>application/octet-stream</parameter>, with the according changes in
4606 <filename>/etc/cups/mime.types</filename> in place.
4610 CUPS is widely configurable and flexible, even regarding its filtering
4611 mechanism. Another workaround in some situations would be to have in
4612 <filename>/etc/cups/mime.types</filename> entries as follows:
4615 application/postscript application/vnd.cups-raw 0 -
4616 application/vnd.cups-postscript application/vnd.cups-raw 0 -
4619 This would prevent all PostScript files from being filtered (rather,
4620 they will through the virtual <emphasis>nullfilter</emphasis>
4621 denoted with <quote>-</quote>). This could only be useful for PostScript printers. If you
4622 want to print PostScript code on non-PostScript printers (provided they support ASCII
4623 text printing), an entry as follows could be useful:
4626 */* application/vnd.cups-raw 0 -
4629 and would effectively send <emphasis>all</emphasis> files to the
4630 backend without further processing.
4634 You could have the following entry:
4637 application/vnd.cups-postscript application/vnd.cups-raw 0 \
4638 my_PJL_stripping_filter
4641 You will need to write a <parameter>my_PJL_stripping_filter</parameter>
4642 (which could be a shell script) that parses the PostScript and removes the
4643 unwanted PJL. This needs to conform to CUPS filter design
4644 (mainly, receive and pass the parameters printername, job-id,
4645 username, jobtitle, copies, print options, and possibly the
4646 filename). It is installed as world executable into
4647 <filename>/usr/lib/cups/filters/</filename> and is called by CUPS
4648 if it encounters a MIME type <parameter>application/vnd.cups-postscript</parameter>.
4652 CUPS can handle <parameter>-o job-hold-until=indefinite</parameter>.
4653 This keeps the job in the queue on hold. It will only be printed
4654 upon manual release by the printer operator. This is a requirement in
4655 many central reproduction departments, where a few operators manage
4656 the jobs of hundreds of users on some big machine, where no user is
4657 allowed to have direct access (such as when the operators often need
4658 to load the proper paper type before running the 10,000 page job
4659 requested by marketing for the mailing, and so on).
4664 <title>Autodeletion or Preservation of CUPS Spool Files</title>
4667 <indexterm><primary>/var/spool/samba</primary></indexterm>
4668 <indexterm><primary>/var/spool/cups/</primary></indexterm>
4669 <indexterm><primary>cupsd.conf</primary></indexterm>
4670 Samba print files pass through two spool directories. One is the incoming directory managed by Samba (set in
4671 the <smbconfoption name="path">/var/spool/samba</smbconfoption> directive in the <smbconfsection
4672 name="[printers]"/> section of &smb.conf;). The other is the spool directory of your UNIX print subsystem. For
4673 CUPS it is normally <filename>/var/spool/cups/</filename>, as set by the <filename>cupsd.conf</filename>
4674 directive <filename>RequestRoot /var/spool/cups</filename>.
4678 <title>CUPS Configuration Settings Explained</title>
4681 Some important parameter settings in the CUPS configuration file
4682 <filename>cupsd.conf</filename> are:
4687 <varlistentry><term>PreserveJobHistory Yes</term>
4689 This keeps some details of jobs in cupsd's mind (well, it keeps the
4690 c12345, c12346, and so on, files in the CUPS spool directory, which does a
4691 similar job as the old-fashioned BSD-LPD control files). This is set
4692 to <quote>Yes</quote> as a default.
4693 </para></listitem></varlistentry>
4695 <varlistentry><term>PreserveJobFiles Yes</term>
4697 This keeps the job files themselves in cupsd's mind
4698 (it keeps the d12345, d12346, etc., files in the CUPS spool
4699 directory). This is set to <quote>No</quote> as the CUPS
4701 </para></listitem></varlistentry>
4703 <varlistentry><term><quote>MaxJobs 500</quote></term>
4705 This directive controls the maximum number of jobs
4706 that are kept in memory. Once the number of jobs reaches the limit,
4707 the oldest completed job is automatically purged from the system to
4708 make room for the new one. If all of the known jobs are still
4709 pending or active, then the new job will be rejected. Setting the
4710 maximum to 0 disables this functionality. The default setting is
4712 </para></listitem></varlistentry>
4716 (There are also additional settings for <parameter>MaxJobsPerUser</parameter> and
4717 <parameter>MaxJobsPerPrinter</parameter>.)
4722 <title>Preconditions</title>
4725 For everything to work as it should, you need to have three things:
4729 <listitem><para>A Samba smbd that is compiled against <filename>libcups</filename> (check
4730 on Linux by running <userinput>ldd `which smbd'</userinput>).</para></listitem>
4732 <listitem><para>A Samba-&smb.conf; setting of
4733 <smbconfoption name="printing">cups</smbconfoption>.</para></listitem>
4735 <listitem><para>Another Samba &smb.conf; setting of
4736 <smbconfoption name="printcap">cups</smbconfoption>.</para></listitem>
4740 In this case, all other manually set printing-related commands (like
4741 <smbconfoption name="print command"/>,
4742 <smbconfoption name="lpq command"/>,
4743 <smbconfoption name="lprm command"/>,
4744 <smbconfoption name="lppause command"/>, and
4745 <smbconfoption name="lpresume command"/>) are ignored, and they should normally have no
4746 influence whatsoever on your printing.
4751 <title>Manual Configuration</title>
4754 If you want to do things manually, replace the <smbconfoption name="printing">cups</smbconfoption>
4755 by <smbconfoption name="printing">bsd</smbconfoption>. Then your manually set commands may work
4756 (I haven't tested this), and a <smbconfoption name="print command">lp -d %P %s; rm %s</smbconfoption>
4757 may do what you need.
4763 <title>Printing from CUPS to Windows-Attached Printers</title>
4766 <indexterm><primary>smbspool</primary></indexterm>
4767 <indexterm><primary>backends</primary></indexterm>
4768 From time to time the question arises, how can you print <emphasis>to</emphasis> a Windows-attached printer
4769 <emphasis>from</emphasis> Samba? Normally the local connection from Windows host to printer would be done by
4770 USB or parallel cable, but this does not matter to Samba. From here only an SMB connection needs to be opened
4771 to the Windows host. Of course, this printer must be shared first. As you have learned by now, CUPS uses
4772 <emphasis>backends</emphasis> to talk to printers and other servers. To talk to Windows shared printers, you
4773 need to use the <filename>smb</filename> (surprise, surprise!) backend. Check if this is in the CUPS backend
4774 directory. This usually resides in <filename>/usr/lib/cups/backend/</filename>. You need to find an
4775 <filename>smb</filename> file there. It should be a symlink to <filename>smbspool</filename>, and the file
4776 must exist and be executable:
4778 &rootprompt;<userinput>ls -l /usr/lib/cups/backend/</userinput>
4780 drwxr-xr-x 3 root root 720 Apr 30 19:04 .
4781 drwxr-xr-x 6 root root 125 Dec 19 17:13 ..
4782 -rwxr-xr-x 1 root root 10692 Feb 16 21:29 canon
4783 -rwxr-xr-x 1 root root 10692 Feb 16 21:29 epson
4784 lrwxrwxrwx 1 root root 3 Apr 17 22:50 http -> ipp
4785 -rwxr-xr-x 1 root root 17316 Apr 17 22:50 ipp
4786 -rwxr-xr-x 1 root root 15420 Apr 20 17:01 lpd
4787 -rwxr-xr-x 1 root root 8656 Apr 20 17:01 parallel
4788 -rwxr-xr-x 1 root root 2162 Mar 31 23:15 pdfdistiller
4789 lrwxrwxrwx 1 root root 25 Apr 30 19:04 ptal -> /usr/sbin/ptal-cups
4790 -rwxr-xr-x 1 root root 6284 Apr 20 17:01 scsi
4791 lrwxrwxrwx 1 root root 17 Apr 2 03:11 smb -> /usr/bin/smbspool
4792 -rwxr-xr-x 1 root root 7912 Apr 20 17:01 socket
4793 -rwxr-xr-x 1 root root 9012 Apr 20 17:01 usb
4795 &rootprompt;<userinput>ls -l `which smbspool`</userinput>
4796 -rwxr-xr-x 1 root root 563245 Dec 28 14:49 /usr/bin/smbspool
4800 If this symlink does not exist, create it:
4802 &rootprompt;<userinput>ln -s `which smbspool` /usr/lib/cups/backend/smb</userinput>
4806 <indexterm><primary>smbspool</primary></indexterm>
4807 <indexterm><primary>troubleshooting</primary></indexterm>
4808 <command>smbspool</command> was written by Mike Sweet from the CUPS folks. It is included and ships with
4809 Samba. It may also be used with print subsystems other than CUPS, to spool jobs to Windows printer shares. To
4810 set up printer <replaceable>winprinter</replaceable> on CUPS, you need to have a driver for it. Essentially
4811 this means to convert the print data on the CUPS/Samba host to a format that the printer can digest (the
4812 Windows host is unable to convert any files you may send). This also means you should be able to print to the
4813 printer if it were hooked directly at your Samba/CUPS host. For troubleshooting purposes, this is what you
4814 should do to determine if that part of the process chain is in order. Then proceed to fix the network
4815 connection/authentication to the Windows host, and so on.
4819 To install a printer with the <parameter>smb</parameter> backend on CUPS, use this command:
4823 &rootprompt;<userinput>lpadmin -p winprinter -v smb://WINDOWSNETBIOSNAME/printersharename \
4824 -P /path/to/PPD</userinput>
4828 <indexterm><primary>PostScript printers</primary></indexterm>
4829 <indexterm><primary>PPD</primary></indexterm>
4830 <indexterm><primary>Windows NT PostScript driver</primary></indexterm>
4831 The PPD must be able to direct CUPS to generate the print data for the target model. For PostScript printers,
4832 just use the PPD that would be used with the Windows NT PostScript driver. But what can you do if the printer
4833 is only accessible with a password? Or if the printer's host is part of another workgroup? This is provided
4834 for: You can include the required parameters as part of the <filename>smb://</filename> device-URI like this:
4838 <listitem><para><filename>smb://WORKGROUP/WINDOWSNETBIOSNAME/printersharename</filename></para></listitem>
4839 <listitem><para><filename>smb://username:password@WORKGROUP/WINDOWSNETBIOSNAME/printersharename</filename></para></listitem>
4840 <listitem><para><filename>smb://username:password@WINDOWSNETBIOSNAME/printersharename</filename></para></listitem>
4844 Note that the device URI will be visible in the process list of the Samba server (e.g., when someone uses the
4845 <command>ps -aux</command> command on Linux), even if the username and passwords are sanitized before they get
4846 written into the log files. This is an inherently insecure option; however, it is the only one. Don't use it
4847 if you want to protect your passwords. Better share the printer in a way that does not require a password!
4848 Printing will only work if you have a working NetBIOS name resolution up and running. Note that this is a
4849 feature of CUPS and you do not necessarily need to have smbd running.
4855 <title>More CUPS Filtering Chains</title>
4858 The diagrams in <link linkend="cups1">Filtering Chain 1</link> and <link linkend="cups2">Filtering Chain with
4859 cupsomatic</link> show how CUPS handles print jobs.
4863 <title>Filtering Chain 1.</title>
4864 <imagefile>cups1</imagefile>
4869 <title>Filtering Chain with cupsomatic</title>
4870 <imagefile scale="45">cups2</imagefile>
4876 <title>Common Errors</title>
4879 <title>Windows 9x/Me Client Can't Install Driver</title>
4881 <para>For Windows 9x/Me, clients require the printer names to be eight
4882 characters (or <quote>8 plus 3 chars suffix</quote>) max; otherwise, the driver files
4883 will not get transferred when you want to download them from Samba.</para>
4887 <sect2 id="root-ask-loop">
4888 <title><quote>cupsaddsmb</quote> Keeps Asking for Root Password in Never-ending Loop</title>
4890 <para>Have you set <smbconfoption name="security">user</smbconfoption>? Have
4891 you used <command>smbpasswd</command> to give root a Samba account?
4892 You can do two things: open another terminal and execute
4893 <command>smbpasswd -a root</command> to create the account and
4894 continue entering the password into the first terminal. Or, break
4895 out of the loop by pressing Enter twice (without trying to type a
4899 If the error is <quote>Tree connect failed: NT_STATUS_BAD_NETWORK_NAME</quote>,
4900 you may have forgotten to create the <filename>/etc/samba/drivers</filename> directory.
4905 <title><quote>cupsaddsmb</quote> or <quote>rpcclient addriver</quote> Emit Error</title>
4908 If <command>cupsaddsmb</command>, or <command>rpcclient addriver</command> emit the error message
4909 WERR_BAD_PASSWORD, refer to <link linkend="root-ask-loop">the previous common error</link>.
4915 <title><quote>cupsaddsmb</quote> Errors</title>
4918 The use of <quote>cupsaddsmb</quote> gives <quote>No PPD file for printer...</quote>
4919 message while PPD file is present. What might the problem be?
4923 Have you enabled printer sharing on CUPS? This means, do you have a <literal><Location
4924 /printers>....</Location></literal> section in CUPS server's <filename>cupsd.conf</filename> that
4925 does not deny access to the host you run <quote>cupsaddsmb</quote> from? It <emphasis>could</emphasis> be an
4926 issue if you use cupsaddsmb remotely, or if you use it with a <option>-h</option> parameter:
4927 <userinput>cupsaddsmb -H sambaserver -h cupsserver -v printername</userinput>.
4930 <para>Is your <parameter>TempDir</parameter> directive in
4931 <filename>cupsd.conf</filename> set to a valid value, and is it writable?
4937 <title>Client Can't Connect to Samba Printer</title>
4939 <para>Use <command>smbstatus</command> to check which user
4940 you are from Samba's point of view. Do you have the privileges to
4941 write into the <smbconfsection name="[print$]"/>
4947 <title>New Account Reconnection from Windows 200x/XP Troubles</title>
4950 Once you are connected as the wrong user (for example, as <constant>nobody</constant>, which often occurs if
4951 you have <smbconfoption name="map to guest">bad user</smbconfoption>), Windows Explorer will not accept an
4952 attempt to connect again as a different user. There will not be any bytes transferred on the wire to Samba,
4953 but still you'll see a stupid error message that makes you think Samba has denied access. Use
4954 <command>smbstatus</command> to check for active connections. Kill the PIDs. You still can't re-connect, and
4955 you get the dreaded <computeroutput>You can't connect with a second account from the same
4956 machine</computeroutput> message as soon as you try. And you do not see a single byte arriving at Samba (see
4957 logs; use <quote>ethereal</quote>) indicating a renewed connection attempt. Shut all Explorer Windows. This
4958 makes Windows forget what it has cached in its memory as established connections. Then reconnect as the right
4959 user. The best method is to use a DOS terminal window and <emphasis>first</emphasis> do <userinput>net use z:
4960 \\&example.server.samba;\print$ /user:root</userinput>. Check with <command>smbstatus</command> that you are
4961 connected under a different account. Now open the <guilabel>Printers</guilabel> folder (on the Samba server in
4962 the <guilabel>Network Neighborhood</guilabel>), right-click on the printer in question, and select
4963 <guibutton>Connect....</guibutton>.
4968 <title>Avoid Being Connected to the Samba Server as the Wrong User</title>
4971 <indexterm><primary>smbstatus</primary></indexterm>
4972 You see per <command>smbstatus</command> that you are connected as user nobody, but you want to be root or
4973 printer admin. This is probably due to <smbconfoption name="map to guest">bad user</smbconfoption>, which
4974 silently connected you under the guest account when you gave (maybe by accident) an incorrect username. Remove
4975 <smbconfoption name="map to guest"/> if you want to prevent this.
4980 <title>Upgrading to CUPS Drivers from Adobe Drivers</title>
4983 This information came from a mailing list posting regarding problems experienced when
4984 upgrading from Adobe drivers to CUPS drivers on Microsoft Windows NT/200x/XP clients.
4987 <para>First delete all old Adobe-using printers. Then delete all old Adobe drivers. (On Windows 200x/XP, right-click in
4988 the background of <guilabel>Printers</guilabel> folder, select <guimenuitem>Server Properties...</guimenuitem>, select
4989 tab <guilabel>Drivers</guilabel>, and delete here).</para>
4993 <title>Can't Use <quote>cupsaddsmb</quote> on Samba Server, Which Is a PDC</title>
4995 <para>Do you use the <quote>naked</quote> root user name? Try to do it
4996 this way: <userinput>cupsaddsmb -U <replaceable>DOMAINNAME</replaceable>\\root -v
4997 <replaceable>printername</replaceable></userinput>> (note the two backslashes: the first one is
4998 required to <quote>escape</quote> the second one).</para>
5003 <title>Deleted Windows 200x Printer Driver Is Still Shown</title>
5005 <para>Deleting a printer on the client will not delete the
5006 driver too (to verify, right-click on the white background of the
5007 <guilabel>Printers</guilabel> folder, select <guimenuitem>Server Properties</guimenuitem> and click on the
5008 <guilabel>Drivers</guilabel> tab). These same old drivers will be re-used when you try to
5009 install a printer with the same name. If you want to update to a new
5010 driver, delete the old ones first. Deletion is only possible if no
5011 other printer uses the same driver.</para>
5015 <title>Windows 200x/XP Local Security Policies</title>
5017 <indexterm><primary>Local security policies</primary></indexterm>
5018 <indexterm><primary>unsigned drivers</primary></indexterm>
5019 <para>Local security policies may not allow the installation of unsigned drivers &smbmdash; <quote>local
5020 security policies</quote> may not allow the installation of printer drivers at all.</para>
5025 <title>Administrator Cannot Install Printers for All Local Users</title>
5028 <indexterm><primary>SMB printers</primary></indexterm>
5029 <indexterm><primary>IPP client</primary></indexterm>
5030 Windows XP handles SMB printers on a <quote>per-user</quote> basis.
5031 This means every user needs to install the printer himself or herself. To have a printer available for
5032 everybody, you might want to use the built-in IPP client capabilities of Win XP. Add a printer with the print
5033 path of <parameter>http://cupsserver:631/printers/printername</parameter>. We're still looking into this one.
5034 Maybe a logon script could automatically install printers for all users.
5040 <title>Print Change, Notify Functions on NT Clients</title>
5042 <para>For print change, notify functions on NT++ clients. These need to run the <command>Server</command>
5043 service first (renamed to <command>File & Print Sharing for MS Networks</command> in XP).</para>
5048 <title>Windows XP SP1</title>
5050 <para>Windows XP SP1 introduced a Point and Print Restriction Policy (this restriction does not apply to
5051 <quote>Administrator</quote> or <quote>Power User</quote> groups of users). In Group Policy Object Editor, go
5052 to <guimenu>User Configuration -> Administrative Templates -> Control Panel -> Printers</guimenu>. The policy
5053 is automatically set to <constant>Enabled</constant> and the <constant>Users can only Point and Print to
5054 machines in their Forest</constant> . You probably need to change it to <constant>Disabled</constant> or
5055 <constant>Users can only Point and Print to these servers</constant> to make driver downloads from Samba
5061 <title>Print Options for All Users Can't Be Set on Windows 200x/XP</title>
5063 <para>How are you doing it? I bet the wrong way (it is not easy to find out, though). There are three
5064 different ways to bring you to a dialog that <emphasis>seems</emphasis> to set everything. All three dialogs
5065 <emphasis>look</emphasis> the same, yet only one of them does what you intend. You need to be Administrator or
5066 Print Administrator to do this for all users. Here is how I do it on XP:
5069 <orderedlist numeration="upperalpha">
5071 <listitem><para>The first wrong way:
5074 <listitem><para>Open the <guilabel>Printers</guilabel>
5075 folder.</para></listitem>
5077 <listitem><para>Right-click on the printer
5078 (<guilabel>remoteprinter on cupshost</guilabel>) and
5079 select in context menu <guimenuitem>Printing
5080 Preferences...</guimenuitem></para></listitem>.
5082 <listitem><para>Look at this dialog closely and remember what it looks like.</para></listitem>
5086 <listitem><para>The second wrong way:
5088 <listitem><para>Open the <guilabel>Printers</guilabel> folder.</para></listitem>
5090 <listitem><para>Right-click on the printer (<guilabel>remoteprinter on
5091 cupshost</guilabel>) and select the context menu
5092 <guimenuitem>Properties</guimenuitem>.</para></listitem>
5094 <listitem><para>Click on the <guilabel>General</guilabel> tab.</para></listitem>
5096 <listitem><para>Click on the button <guibutton>Printing
5097 Preferences...</guibutton></para></listitem>.
5099 <listitem><para>A new dialog opens. Keep this dialog open and go back
5100 to the parent dialog.</para></listitem>
5104 <listitem><para>The third and correct way:
5106 <listitem><para>Open the <guilabel>Printers</guilabel> folder.</para></listitem>
5108 <listitem><para>Right-click on the printer (<guilabel>remoteprinter on
5109 cupshost</guilabel>) and select the context menu
5110 <guimenuitem>Properties</guimenuitem>.</para></listitem>
5112 <listitem><para>Click on the <guilabel>Advanced</guilabel>
5113 tab. (If everything is <quote>grayed out,</quote> then you are not logged
5114 in as a user with enough privileges).</para></listitem>
5116 <listitem><para>Click on the <guibutton>Printing
5117 Defaults...</guibutton> button.</para></listitem>
5119 <listitem><para>On any of the two new tabs, click on the
5120 <guibutton>Advanced...</guibutton> button.</para></listitem>
5122 <listitem><para>A new dialog opens. Compare this one to the other
5123 identical-looking one from step <quote>B.5</quote> or A.3".</para></listitem>
5129 Do you see any difference? I don't either. However, only the last one, which you arrived at with steps
5130 <quote>C.1. to C.6.</quote>, will save any settings permanently and be the defaults for new users. If you want
5131 all clients to get the same defaults, you need to conduct these steps <emphasis>as Administrator</emphasis>
5132 (<smbconfoption name="printer admin"/> in &smb.conf;) <emphasis>before</emphasis> a client downloads the
5133 driver (the clients can later set their own <emphasis>per-user defaults</emphasis> by following the procedures
5134 <emphasis>A</emphasis> or <emphasis>B</emphasis>).
5140 <title>Most Common Blunders in Driver Settings on Windows Clients</title>
5143 Don't use <parameter>Optimize for Speed</parameter>, but use <parameter>Optimize for Portability</parameter>
5144 instead (Adobe PS Driver). Don't use <parameter>Page Independence: No</parameter>. Always settle with
5145 <parameter>Page Independence: Yes</parameter> (Microsoft PS Driver and CUPS PS Driver for Windows NT/200x/XP).
5146 If there are problems with fonts, use <parameter>Download as Softfont into printer</parameter> (Adobe PS
5147 Driver). For <guilabel>TrueType Download Options</guilabel> choose <constant>Outline</constant>. Use
5148 PostScript Level 2 if you are having trouble with a non-PS printer and if there is a choice.
5154 <title><command>cupsaddsmb</command> Does Not Work with Newly Installed Printer</title>
5157 Symptom: The last command of <command>cupsaddsmb</command> does not complete successfully. If the <command>cmd
5158 = setdriver printername printername</command> result was NT_STATUS_UNSUCCESSFUL, then possibly the printer was
5159 not yet recognized by Samba. Did it show up in Network Neighborhood? Did it show up in <command>rpcclient
5160 hostname -c `enumprinters'</command>? Restart smbd (or send a <command>kill -HUP</command> to all processes
5161 listed by <command>smbstatus</command>, and try again.
5165 <title>Permissions on <filename>/var/spool/samba/</filename> Get Reset After Each Reboot</title>
5168 Have you ever by accident set the CUPS spool directory to the same location (<parameter>RequestRoot
5169 /var/spool/samba/</parameter> in <filename>cupsd.conf</filename> or the other way round:
5170 <filename>/var/spool/cups/</filename> is set as <smbconfoption name="path"/>> in the <smbconfsection
5171 name="[printers]"/> section)? These <parameter>must</parameter> be different. Set <parameter>RequestRoot
5172 /var/spool/cups/</parameter> in <filename>cupsd.conf</filename> and <smbconfoption name="path">
5173 /var/spool/samba</smbconfoption> in the <smbconfsection name="[printers]"/> section of &smb.conf;. Otherwise,
5174 cupsd will sanitize permissions to its spool directory with each restart and printing will not work reliably.
5180 <title>Print Queue Called <quote>lp</quote> Mishandles Print Jobs</title>
5183 In this case a print queue called <quote>lp</quote> intermittently swallows jobs and
5184 spits out completely different ones from what was sent.
5188 <indexterm><primary>lp</primary></indexterm>
5189 <indexterm><primary>Implicit Classes</primary></indexterm>
5190 <indexterm><primary>BrowseShortNames</primary></indexterm>
5191 It is a bad idea to name any printer <quote>lp</quote>. This is the traditional UNIX name for the default
5192 printer. CUPS may be set up to do an automatic creation of Implicit Classes. This means, to group all printers
5193 with the same name to a pool of devices and load-balance the jobs across them in a round-robin fashion.
5194 Chances are high that someone else has a printer named <quote>lp</quote> too. You may receive that person's
5195 jobs and send your own to his or her device unwittingly. To have tight control over the printer names, set
5196 <parameter>BrowseShortNames No</parameter>. It will present any printer as
5197 <replaceable>printername@cupshost</replaceable>, which gives you better control over what may happen in a
5198 large networked environment.
5204 <title>Location of Adobe PostScript Driver Files for <quote>cupsaddsmb</quote></title>
5207 Use <command>smbclient</command> to connect to any Windows box with a shared PostScript printer:
5208 <command>smbclient //windowsbox/print\$ -U guest</command>. You can navigate to the
5209 <filename>W32X86/2</filename> subdir to <command>mget ADOBE*</command> and other files or to
5210 <filename>WIN40/0</filename> to do the same. Another option is to download the <filename>*.exe</filename>
5211 packaged files from the Adobe Web site.
5219 <title>Overview of the CUPS Printing Processes</title>
5222 A complete overview of the CUPS printing processes can be found in <link linkend="a_small">the CUPS
5223 Printing Overview diagram</link>.
5226 <figure id="a_small">
5227 <title>CUPS Printing Overview.</title>
5228 <imagefile scale="45">a_small</imagefile>