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="public">yes</smbconfoption>
189 <smbconfoption name="guest ok">yes</smbconfoption>
190 <smbconfoption name="writable">no</smbconfoption>
191 <smbconfoption name="printable">yes</smbconfoption>
192 <smbconfoption name="printer admin">root, @ntadmins</smbconfoption>
197 <indexterm><primary>PDF</primary></indexterm>
198 <indexterm><primary>PostScript</primary></indexterm>
199 <indexterm><primary>printer driver</primary></indexterm>
200 This is all you need for basic printing setup for CUPS. It will print all graphic, text, PDF, and PostScript
201 files submitted from Windows clients. However, most of your Windows users would not know how to send these
202 kinds of files to print without opening a GUI application. Windows clients tend to have local printer drivers
203 installed, and the GUI application's print buttons start a printer driver. Your users also rarely send files
204 from the command line. Unlike UNIX clients, they rarely submit graphic, text, or PDF formatted files directly
205 to the spooler. They nearly exclusively print from GUI applications with a <quote>printer driver</quote>
206 hooked between the application's native format and the print data stream. If the backend printer is not a
207 PostScript device, the print data stream is <quote>binary,</quote> sensible only for the target printer. Read
208 on to learn what problem this may cause and how to avoid it.
214 <title>More Complex CUPS &smb.conf; Settings</title>
217 <link linkend="overridesettings">The Overriding Global CUPS Settings for One Printer example</link>
218 is a slightly more complex printing-related setup for &smb.conf;. It enables general CUPS printing
219 support for all printers, but defines one printer share, which is set up differently.
222 <example id="overridesettings">
223 <title>Overriding Global CUPS Settings for One Printer</title>
225 <smbconfsection name="[global]"/>
226 <smbconfoption name="printing">cups</smbconfoption>
227 <smbconfoption name="printcap name">cups</smbconfoption>
228 <smbconfoption name="load printers">yes</smbconfoption>
230 <smbconfsection name="[printers]"/>
231 <smbconfoption name="comment">All Printers</smbconfoption>
232 <smbconfoption name="path">/var/spool/samba</smbconfoption>
233 <smbconfoption name="public">yes</smbconfoption>
234 <smbconfoption name="guest ok">yes</smbconfoption>
235 <smbconfoption name="writable">no</smbconfoption>
236 <smbconfoption name="printable">yes</smbconfoption>
237 <smbconfoption name="printer admin">root, @ntadmins</smbconfoption>
239 <smbconfsection name="[special_printer]"/>
240 <smbconfoption name="comment">A special printer with his own settings</smbconfoption>
241 <smbconfoption name="path">/var/spool/samba-special</smbconfoption>
242 <smbconfoption name="printing">sysv</smbconfoption>
243 <smbconfoption name="printcap">lpstat</smbconfoption>
244 <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>
245 <smbconfoption name="public">no</smbconfoption>
246 <smbconfoption name="guest ok">no</smbconfoption>
247 <smbconfoption name="writable">no</smbconfoption>
248 <smbconfoption name="printable">yes</smbconfoption>
249 <smbconfoption name="printer admin">kurt</smbconfoption>
250 <smbconfoption name="hosts deny">0.0.0.0</smbconfoption>
251 <smbconfoption name="hosts allow">turbo_xp, 10.160.50.23, 10.160.51.60</smbconfoption>
256 This special share is only for testing purposes. It does not write the print job to a file. It just logs the job parameters
257 known to Samba into the <filename>/tmp/smbprn.log</filename> file and deletes the job-file. Moreover, the
258 <smbconfoption name="printer admin"/> of this share is <quote>kurt</quote> (not the <quote>@ntadmins</quote> group),
259 guest access is not allowed, the share isn't published to the Network Neighborhood (so you need to know it is there), and it
260 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
261 <smbconfoption name="printing">sysv</smbconfoption> and <smbconfoption name="printcap">lpstat</smbconfoption>.
269 <title>Advanced Configuration</title>
272 Before we delve into all the configuration options, let us clarify a few points. <emphasis>Network printing
273 needs to be organized and set up correctly</emphasis>. This frequently doesn't happen. Legacy systems or small
274 business LAN environments often lack design and good housekeeping.
279 <title>Central Spooling vs. <quote>Peer-to-Peer</quote> Printing</title>
283 <indexterm><primary>spooling</primary></indexterm>
284 <indexterm><primary>spooling</primary><secondary>central</secondary></indexterm>
285 <indexterm><primary>spooling</primary><secondary>peer-to-peer</secondary></indexterm>
286 Many small office or home networks, as well as badly organized larger environments, allow each client a direct
287 access to available network printers. This is generally a bad idea. It often blocks one client's access to the
288 printer when another client's job is printing. It might freeze the first client's application while it is
289 waiting to get rid of the job. Also, there are frequent complaints about various jobs being printed with their
290 pages mixed with each other. A better concept is the use of a print server: it routes all jobs through one
291 central system, which responds immediately, takes jobs from multiple concurrent clients, and transfers them to
292 the printer(s) in the correct order.
298 <title>Raw Print Serving: Vendor Drivers on Windows Clients</title>
301 <indexterm><primary>spooling-only</primary></indexterm>
302 <indexterm><primary>raw printing</primary></indexterm>
303 Most traditionally configured UNIX print servers acting on behalf of
304 Samba's Windows clients represented a really simple setup. Their only
305 task was to manage the <quote>raw</quote> spooling of all jobs handed to them by
306 Samba. This approach meant that the Windows clients were expected to
307 prepare the print job file that is ready to be sent to the printing
308 device. In this case, a native (vendor-supplied) Windows printer driver needs to
309 be installed on each and every client for the target device.
313 <indexterm><primary>render</primary></indexterm>
314 <indexterm><primary>vendor-provided drivers</primary></indexterm>
315 It is possible to configure CUPS, Samba, and your Windows clients in the
316 same traditional and simple way. When CUPS printers are configured
317 for raw print-through mode operation, it is the responsibility of the
318 Samba client to fully render the print job (file). The file must be
319 sent in a format that is suitable for direct delivery to the
320 printer. Clients need to run the vendor-provided drivers to do
321 this. In this case, CUPS will not do any print file format conversion
326 The easiest printing configuration possible is raw print-through.
327 This is achieved by installation of the printer as if it were physically
328 attached to the Windows client. You then redirect output to a raw network
329 print queue. This procedure may be followed to achieve this:
333 <title>Configuration Steps for Raw CUPS Printing Support</title>
336 <indexterm><primary>/etc/cups/mime.types</primary></indexterm>
337 Edit <filename>/etc/cups/mime.types</filename> to uncomment the line
338 near the end of the file that has:
340 #application/octet-...
345 <indexterm><primary>/etc/cups/mime.convs</primary></indexterm>
346 Do the same for the file <filename>/etc/cups/mime.convs</filename>.
350 Add a raw printer using the Web interface. Point your browser at
351 <constant>http://localhost:631</constant>. Enter Administration, and add
352 the printer following the prompts. Do not install any drivers for it.
353 Choose Raw. Choose queue name <constant>Raw Queue</constant>.
357 In the &smb.conf; file <constant>[printers]</constant> section add
358 <smbconfoption name="use client driver">Yes</smbconfoption>,
359 and in the <constant>[global]</constant> section add
360 <smbconfoption name="printing">CUPS</smbconfoption>, plus
361 <smbconfoption name="printcap">CUPS</smbconfoption>.
365 Install the printer as if it is a local printer, that is, Printing to <constant>LPT1:</constant>.
369 Edit the configuration under the <guimenu>Detail</guimenu> tab and create a
370 <constant>local port</constant> that points to the raw printer queue that
371 you have configured above. Example: <constant>\\server\raw_q</constant>.
372 Here, the name <constant>raw_q</constant> is the name you gave the print
373 queue in the CUPS environment.
380 <title>Installation of Windows Client Drivers</title>
383 The printer drivers on the Windows clients may be installed
384 in two functionally different ways:
388 <listitem><para>Manually install the drivers locally on each client,
389 one by one; this yields the old LanMan style
390 printing and uses a <filename>\\sambaserver\printershare</filename>
391 type of connection.</para></listitem>
395 <indexterm><primary>point 'n' print</primary></indexterm>
396 Deposit and prepare the drivers (for later download) on
397 the print server (Samba); this enables the clients to use
398 <quote>Point'n'Print</quote> to get drivers semi-automatically installed the
399 first time they access the printer; with this method NT/200x/XP
400 clients use the <emphasis>SPOOLSS/MS-RPC</emphasis>
401 type printing calls.</para></listitem>
405 The second method is recommended for use over the first.
409 <sect2 id="cups-raw">
410 <title>Explicitly Enable <quote>raw</quote> Printing for <emphasis>application/octet-stream</emphasis></title>
414 <indexterm><primary>application/octet-stream</primary></indexterm>
415 <indexterm><primary>raw printing</primary></indexterm>
416 <indexterm><primary>MIME</primary><secondary>raw</secondary></indexterm>
417 If you use the first option (drivers are installed on the client
418 side), there is one setting to take care of: CUPS needs to be told
419 that it should allow <quote>raw</quote> printing of deliberate (binary) file
420 formats. The CUPS files that need to be correctly set for raw mode
421 printers to work are:
425 <listitem><para><filename>/etc/cups/mime.types</filename></para></listitem>
426 <listitem><para><filename>/etc/cups/mime.convs</filename></para></listitem>
430 Both contain entries (at the end of the respective files) that must be uncommented to allow RAW mode
431 operation. In <filename>/etc/cups/mime.types</filename>, make sure this line is present:
433 application/octet-stream
435 <indexterm><primary>/etc/cups/mime.convs</primary></indexterm>
436 <indexterm><primary>/etc/cups/mime.types</primary></indexterm>
437 In <filename>/etc/cups/mime.convs</filename>, have this line:
438 <indexterm><primary>application/vnd.cups-raw</primary></indexterm>
440 application/octet-stream application/vnd.cups-raw 0 -
442 If these two files are not set up correctly for raw Windows client
443 printing, you may encounter the dreaded <computeroutput>Unable to
444 convert file 0</computeroutput> in your CUPS <filename>error_log</filename> file.
448 Editing the <filename>mime.convs</filename> and the <filename>mime.types</filename> file does
449 not <emphasis>enforce</emphasis> <quote>raw</quote> printing, it only <emphasis>allows</emphasis> it.
452 <formalpara><title>Background</title>
455 <indexterm><primary>application/octet-stream</primary></indexterm>
456 <indexterm><primary>MIME type</primary></indexterm>
457 That CUPS is a more security-aware printing system than traditional ones does not by default allow a user to
458 send deliberate (possibly binary) data to printing devices. This could be easily abused to launch a
459 <quote>Denial of Service</quote> attack on your printer(s), causing at least the loss of a lot of paper and
460 ink. <quote>Unknown</quote> data are tagged by CUPS as <parameter>MIME type: application/octet-stream</parameter>
461 and not allowed to go to the printer. By default, you can only send other (known) MIME types <quote>raw.</quote>
462 Sending data <quote>raw</quote> means that CUPS does not try to convert them and passes them to the printer
468 This is all you need to know to get the CUPS/Samba combo printing
469 <quote>raw</quote> files prepared by Windows clients, which have vendor drivers
470 locally installed. If you are not interested in background information about
471 more advanced CUPS/Samba printing, simply skip the remaining sections
478 <title>Driver Upload Methods</title>
481 This section describes three familiar methods, plus one new one, by which
482 printer drivers may be uploaded.
486 <indexterm><primary>point'n'print</primary></indexterm>
487 If you want to use the MS-RPC-type printing, you must upload the
488 drivers onto the Samba server first (<smbconfsection name="[print$]"/>
489 share). For a discussion on how to deposit printer drivers on the
490 Samba host (so the Windows clients can download and use them via
491 <quote>Point'n'Print</quote>), please refer to the <link linkend="classicalprinting">Classical Printing
492 chapter</link> of this book. There you will find a description or reference to
493 three methods of preparing the client drivers on the Samba server:
498 <indexterm><primary>add printer wizard</primary></indexterm>
499 The GUI, <quote>Add Printer Wizard</quote> <emphasis>upload-from-a-Windows-client</emphasis> method.
503 The command line, <quote>smbclient/rpcclient</quote> upload-from-a-UNIX-workstation method.
507 <indexterm><primary>imprints</primary></indexterm>
508 The Imprints tool set method.
513 <indexterm><primary>cupsaddsmb</primary></indexterm>
514 These three methods apply to CUPS all the same. The <command>cupsaddsmb</command> utility is a new and more
515 convenient way to load the Windows drivers into Samba and is provided if you use CUPS.
519 <command>cupsaddsmb</command> is discussed in much detail later in this chapter. But we first
520 explore the CUPS filtering system and compare the Windows and UNIX printing architectures.
528 <title>Advanced Intelligent Printing with PostScript Driver Download</title>
531 <indexterm><primary>PostScript</primary><seealso>Ghostscript</seealso></indexterm>
532 We now know how to set up a <quote>dump</quote> print server, that is, a server that spools
533 print jobs <quote>raw</quote>, leaving the print data untouched.
537 You might need to set up CUPS in a smarter way. The reasons could be manifold:
540 <indexterm><primary>print statistics</primary></indexterm>
541 <indexterm><primary>average print run</primary></indexterm>
542 <indexterm><primary>print quota</primary></indexterm>
544 <listitem><para>Maybe your boss wants to get monthly statistics: Which
545 printer did how many pages? What was the average data size of a job?
546 What was the average print run per day? What are the typical hourly
547 peaks in printing? Which department prints how much?</para></listitem>
549 <listitem><para>Maybe you are asked to set up a print quota system:
550 Users should not be able to print more jobs once they have surpassed
551 a given limit per period.</para></listitem>
553 <listitem><para>Maybe your previous network printing setup is a mess
554 and must be re-organized from a clean beginning.</para></listitem>
556 <listitem><para>Maybe you are experiencing too many <quote>blue screens</quote>
557 originating from poorly debugged printer drivers running in NT <quote>kernel mode</quote>?</para></listitem>
561 These goals cannot be achieved by a raw print server. To build a
562 server meeting these requirements, you'll first need to learn
563 how CUPS works and how you can enable its features.
567 What follows is the comparison of some fundamental concepts for
568 Windows and UNIX printing, then a description of the
569 CUPS filtering system, how it works, and how you can tweak it.
573 <title>GDI on Windows, PostScript on UNIX</title>
576 <indexterm><primary>GDI</primary></indexterm>
577 <indexterm><primary>PostScript</primary></indexterm>
578 Network printing is one of the most complicated and error-prone
579 day-to-day tasks any user or administrator may encounter. This is
580 true for all OS platforms, and there are reasons it is so.
585 <indexterm><primary>PCL</primary></indexterm>
586 <indexterm><primary>PDL</primary></indexterm>
587 <indexterm><primary>PostScript</primary></indexterm>
588 <indexterm><primary>Adobe</primary></indexterm>
589 <indexterm><primary>page description languages</primary><see>PDL</see></indexterm>
590 You can't expect to throw just any file format at a printer and have it get printed. A file format conversion
591 must take place. The problem is that there is no common standard for print file formats across all
592 manufacturers and printer types. While PostScript (trademark held by Adobe) and, to an extent, PCL (trademark
593 held by Hewlett-Packard) have developed into semi-official <quote>standards</quote> by being the most widely
594 used page description languages (PDLs), there are still many manufacturers who <quote>roll their own</quote>
595 (their reasons may be unacceptable license fees for using printer-embedded PostScript interpreters, and so on).
601 <title>Windows Drivers, GDI, and EMF</title>
604 <indexterm><primary>GDI</primary></indexterm>
605 <indexterm><primary>EMF</primary></indexterm>
606 <indexterm><primary>WYSIWYG</primary></indexterm>
607 <indexterm><primary>Enhanced MetaFile</primary><see>EMF</see></indexterm>
608 In Windows OS, the format conversion job is done by the printer drivers. On MS Windows OS platforms all
609 application programmers have at their disposal a built-in API, the graphical device interface (GDI), as part
610 and parcel of the OS itself to base themselves on. This GDI core is used as one common unified ground for all
611 Windows programs to draw pictures, fonts, and documents <emphasis>on screen</emphasis> as well as <emphasis>on
612 paper</emphasis> (print). Therefore, printer driver developers can standardize on a well-defined GDI output
613 for their own driver input. Achieving WYSIWYG (What You See Is What You Get) is relatively easy, because the
614 on-screen graphic primitives, as well as the on-paper drawn objects, come from one common source. This source,
615 the GDI, often produces a file format called Enhanced MetaFile (EMF). The EMF is processed by the printer
616 driver and converted to the printer-specific file format.
620 <indexterm><primary>PDF</primary></indexterm>
621 <indexterm><primary>Xprint</primary></indexterm>
622 <indexterm><primary>core graphic engine</primary></indexterm>
623 To the GDI foundation in MS Windows, Apple has chosen to put paper and screen output on a common foundation
624 for its (BSD-UNIX-based, did you know?) Mac OS X and Darwin operating <indexterm><primary>X Window
625 System</primary></indexterm> <indexterm><primary>PostScript</primary></indexterm>
626 <indexterm><primary>PCL</primary></indexterm> <indexterm><primary>Xprint</primary></indexterm> systems.
627 Apple's <emphasis>core graphic engine</emphasis> uses a <emphasis>PDF</emphasis> derivative for all display work.
631 The example in <link linkend="1small">Windows Printing to a Local Printer</link> illustrates local Windows
636 <title>Windows Printing to a Local Printer.</title>
637 <imagefile>1small</imagefile>
643 <title>UNIX Printfile Conversion and GUI Basics</title>
646 <indexterm><primary>X Window System</primary></indexterm>
647 <indexterm><primary>PostScript</primary></indexterm>
648 <indexterm><primary>PCL</primary></indexterm>
649 <indexterm><primary>Xprint</primary></indexterm>
650 In UNIX and Linux, there is no comparable layer built into the OS kernel(s) or the X (screen display) server.
651 Every application is responsible for itself to create its print output. Fortunately, most use PostScript and
652 that at least gives some common ground. Unfortunately, there are many different levels of quality for this
653 PostScript. And worse, there is a huge difference (and no common root) in the way the same document is
654 displayed on screen and how it is presented on paper. WYSIWYG is more difficult to achieve. This goes back to
655 the time, decades ago, when the predecessors of X.org, designing the UNIX foundations and protocols for
656 graphical user interfaces, refused to take responsibility for <quote>paper output</quote>, as some had
657 demanded at the time, and restricted itself to <quote>on-screen only.</quote> (For some years now, the
658 <quote>Xprint</quote> project has been under development, attempting to build printing support into the X
659 framework, including a PostScript and a PCL driver, but it is not yet ready for prime time.) You can see this
660 unfavorable inheritance up to the present day by looking into the various <quote>font</quote> directories on
661 your system; there are separate ones for fonts used for X display and fonts to be used on paper.
665 <title>Background</title>
668 <indexterm><primary>PostScript</primary></indexterm>
669 <indexterm><primary>color</primary></indexterm>
670 <indexterm><primary>linewidth</primary></indexterm>
671 <indexterm><primary>scale</primary></indexterm>
672 <indexterm><primary>distort</primary></indexterm>
673 <indexterm><primary>rotate</primary></indexterm>
674 <indexterm><primary>shift</primary></indexterm>
675 <indexterm><primary>raster images</primary></indexterm>
676 <indexterm><primary>display PostScript</primary></indexterm>
677 <indexterm><primary>graphical objects</primary></indexterm>
678 The PostScript programming language is an <quote>invention</quote> by Adobe, but its specifications have been
679 published extensively. Its strength lies in its powerful abilities to describe graphical objects (fonts,
680 shapes, patterns, lines, curves, and dots), their attributes (color, linewidth), and the way to manipulate
681 (scale, distort, rotate, shift) them. Because of its open specification, anybody with the skill can start
682 writing his or her own implementation of a PostScript interpreter and use it to display PostScript files on
683 screen or on paper. Most graphical output devices are based on the concept of <quote>raster images</quote> or
684 <quote>pixels</quote> (one notable exception is pen plotters). Of course, you can look at a PostScript file in
685 its textual form and you will be reading its PostScript code, the language instructions that need to be
686 interpreted by a rasterizer. Rasterizers produce pixel images, which may be displayed on screen by a viewer
687 program or on paper by a printer.
692 <sect2 id="post-and-ghost">
693 <title>PostScript and Ghostscript</title>
696 <indexterm><primary>PostScript</primary></indexterm>
697 <indexterm><primary>GhostScript</primary><seealso>PostScript</seealso></indexterm>
698 <indexterm><primary>PostScript</primary><secondary>RIP</secondary></indexterm>
699 <indexterm><primary>PostScript interpreter</primary></indexterm>
700 <indexterm><primary>raster image processor</primary><see>RIP</see></indexterm>
701 So UNIX is lacking a common ground for printing on paper and displaying on screen. Despite this unfavorable
702 legacy for UNIX, basic printing is fairly easy if you have PostScript printers at your disposal. The reason is
703 that these devices have a built-in PostScript language <quote>interpreter,</quote> also called a raster image
704 processor (RIP), (which makes them more expensive than other types of printers; throw PostScript toward them,
705 and they will spit out your printed pages. The RIP does all the hard work of converting the PostScript drawing
706 commands into a bitmap picture as you see it on paper, in a resolution as done by your printer. This is no
707 different than PostScript printing a file from a Windows origin.
711 <indexterm><primary>PPD</primary></indexterm>
712 <indexterm><primary>PPD-aware</primary></indexterm>
713 <indexterm><primary>PostScript Printer Description</primary><see>PPD</see></indexterm>
714 Traditional UNIX programs and printing systems &smbmdash; while using PostScript &smbmdash; are largely not
715 PPD-aware. PPDs are <quote>PostScript Printer Description</quote> files. They enable you to specify and
716 control all options a printer supports: duplexing, stapling, and punching. Therefore, UNIX users for a long
717 time couldn't choose many of the supported device and job options, unlike Windows or Apple users. But now
718 there is CUPS. as illustrated in <link linkend="2small">Printing to a PostScript Printer</link>.
723 <title>Printing to a PostScript Printer.</title>
724 <imagefile>2small</imagefile>
728 <indexterm><primary>PDL</primary></indexterm>
729 However, there are other types of printers out there. These do not know how to print PostScript. They use
730 their own PDL, often proprietary. To print to them is much more demanding. Since your UNIX applications mostly
731 produce PostScript, and since these devices do not understand PostScript, you need to convert the print files
732 to a format suitable for your printer on the host before you can send it away.
738 <title>Ghostscript: The Software RIP for Non-PostScript Printers</title>
741 <indexterm><primary>GhostScript</primary></indexterm>
742 Here is where Ghostscript kicks in. Ghostscript is the traditional (and quite powerful) PostScript interpreter
743 used on UNIX platforms. It is a RIP in software, capable of doing a <emphasis>lot</emphasis> of file format
744 conversions for a very broad spectrum of hardware devices as well as software file formats. Ghostscript
745 technology and drivers are what enable PostScript printing to non-PostScript hardware. This is shown in
746 <link linkend="3small">Ghostscript as a RIP for Non-PostScript Printers</link>.
750 <title>Ghostscript as a RIP for Non-PostScript Printers.</title>
751 <imagefile>3small</imagefile>
755 <indexterm><primary>PNG</primary></indexterm>
756 <indexterm><primary>AFPL</primary></indexterm>
757 <indexterm><primary>ESP</primary></indexterm>
758 Use the <quote>gs -h</quote> command to check for all built-in <quote>devices</quote> on your Ghostscript
759 version. If you specify a parameter of <parameter>-sDEVICE=png256</parameter> on your Ghostscript command
760 line, you are asking Ghostscript to convert the input into a PNG file. Naming a <quote>device</quote> on the
761 command line is the most important single parameter to tell Ghostscript exactly how it should render the
762 input. New Ghostscript versions are released at fairly regular intervals, now by artofcode LLC. They are
763 initially put under the <quote>AFPL</quote> license, but re-released under the GNU GPL as soon as the next
764 AFPL version appears. GNU Ghostscript is probably the version installed on most Samba systems. But it has some
765 deficiencies. <indexterm><primary>Ghostscript</primary><secondary>ESP</secondary><see>ESP
766 GhostScript</see></indexterm> Therefore, ESP Ghostscript was developed as an enhancement over GNU Ghostscript,
767 with lots of bug-fixes, additional devices, and improvements. It is jointly maintained by developers from
768 CUPS, Gimp-Print, MandrakeSoft, SuSE, Red Hat, and Debian. It includes the <quote>cups</quote> device
769 (essential to print to non-PS printers from CUPS).
775 <title>PostScript Printer Description (PPD) Specification</title>
778 <indexterm><primary>PPD</primary></indexterm>
779 <indexterm><primary>PDL</primary></indexterm>
780 <indexterm><primary>PostScript</primary></indexterm>
781 While PostScript in essence is a PDL to represent the page layout in a device-independent way, real-world
782 print jobs are always ending up being output on hardware with device-specific features. To take care of all
783 the differences in hardware and to allow for innovations, Adobe has specified a syntax and file format for
784 PostScript Printer Description (PPD) files. Every PostScript printer ships with one of these files.
788 PPDs contain all the information about general and special features of the
789 given printer model: Which different resolutions can it handle? Does
790 it have a duplexing unit? How many paper trays are there? What media
791 types and sizes does it take? For each item, it also names the special
792 command string to be sent to the printer (mostly inside the PostScript
793 file) in order to enable it.
797 Information from these PPDs is meant to be taken into account by the
798 printer drivers. Therefore, installed as part of the Windows
799 PostScript driver for a given printer is the printer's PPD. Where it
800 makes sense, the PPD features are presented in the drivers' UI dialogs
801 to display to the user a choice of print options. In the end, the
802 user selections are somehow written (in the form of special
803 PostScript, PJL, JCL, or vendor-dependent commands) into the PostScript
804 file created by the driver.
808 <indexterm><primary>PDF</primary></indexterm>
809 <indexterm><primary>PDF distilling</primary></indexterm>
810 A PostScript file that was created to contain device-specific commands
811 for achieving a certain print job output (e.g., duplexed, stapled, and
812 punched) on a specific target machine may not print as expected, or
813 may not be printable at all on other models; it also may not be fit
814 for further processing by software (e.g., by a PDF distilling program).
819 <title>Using Windows-Formatted Vendor PPDs</title>
822 <indexterm><primary>CUPS</primary></indexterm>
823 <indexterm><primary>PPDs</primary></indexterm>
824 <indexterm><primary>PostScript</primary></indexterm>
825 CUPS can handle all spec-compliant PPDs as supplied by the manufacturers for their PostScript models. Even if
826 a vendor does not mention our favorite OS in his or her manuals and brochures, you can safely trust this:
827 <emphasis>If you get the Windows NT version of the PPD, you can use it unchanged in CUPS</emphasis> and thus
828 access the full power of your printer just like a Windows NT user could!
832 To check the spec compliance of any PPD online, go to <ulink noescape="1"
833 url="http://www.cups.org/testppd.php">http://www.cups.org/testppd.php</ulink> and upload your PPD. You will
834 see the results displayed immediately. CUPS in all versions after 1.1.19 has a much stricter internal PPD
835 parsing and checking code enabled; in case of printing trouble, this online resource should be one of your
840 <indexterm><primary>foomatic</primary></indexterm>
841 <indexterm><primary>cupsomatic</primary></indexterm>
842 For real PostScript printers, <emphasis>do not</emphasis> use the <emphasis>Foomatic</emphasis> or
843 <emphasis>cupsomatic</emphasis> PPDs from Linuxprinting.org. With these devices, the original vendor-provided
844 PPDs are always the first choice.
848 <indexterm><primary>W32X86/2</primary></indexterm>
849 If you are looking for an original vendor-provided PPD of a specific device, and you know that an NT4 box (or
850 any other Windows box) on your LAN has the PostScript driver installed, just use <command>smbclient
851 //NT4-box/print\$ -U username</command> to access the Windows directory where all printer driver files are
852 stored. First look in the <filename>W32X86/2</filename> subdirectory for the PPD you are seeking.
857 <title>CUPS Also Uses PPDs for Non-PostScript Printers</title>
860 <indexterm><primary>non-PostScript</primary></indexterm>
861 <indexterm><primary>PPD</primary></indexterm>
862 <indexterm><primary>CUPS filtering</primary></indexterm>
863 CUPS also uses specially crafted PPDs to handle non-PostScript printers. These PPDs are usually not available
864 from the vendors (and no, you can't just take the PPD of a PostScript printer with the same model name and
865 hope it works for the non-PostScript version too). To understand how these PPDs work for non-PS printers, we
866 first need to dive deeply into the CUPS filtering and file format conversion architecture. Stay tuned.
874 <title>The CUPS Filtering Architecture</title>
877 <indexterm><primary>CUPS filtering</primary></indexterm>
878 <indexterm><primary>Ghostscript</primary></indexterm>
879 <indexterm><primary>MIME type</primary></indexterm>
880 <indexterm><primary>MIME recognition</primary></indexterm>
881 <indexterm><primary>MIME conversion rules</primary></indexterm>
882 The core of the CUPS filtering system is based on Ghostscript. In addition to Ghostscript, CUPS uses some
883 other filters of its own. You (or your OS vendor) may have plugged in even more filters. CUPS handles all data
884 file formats under the label of various MIME types. Every incoming print file is subjected to an initial
885 autotyping. The autotyping determines its given MIME type. A given MIME type implies zero or more possible
886 filtering chains relevant to the selected target printer. This section discusses how MIME types recognition
887 and conversion rules interact. They are used by CUPS to automatically set up a working filtering chain for any
888 given input data format.
892 If CUPS rasterizes a PostScript file natively to a bitmap, this is done in two stages:
897 <indexterm><primary>generic raster format</primary></indexterm>
898 <indexterm><primary>CUPS raster</primary></indexterm>
899 The first stage uses a Ghostscript device named <quote>cups</quote>
900 (this is since version 1.1.15) and produces a generic raster format
901 called <quote>CUPS raster</quote>.
905 <indexterm><primary>raster driver</primary></indexterm>
906 The second stage uses a <quote>raster driver</quote> that converts
907 the generic CUPS raster to a device-specific raster.
912 <indexterm><primary>Ghostscript</primary></indexterm>
913 <indexterm><primary>GNU Ghostscript</primary></indexterm>
914 <indexterm><primary>ESP Ghostscript</primary></indexterm>
915 Make sure your Ghostscript version has the <quote>cups</quote> device compiled in (check with <command>gs -h |
916 grep cups</command>). Otherwise you may encounter the dreaded <computeroutput>Unable to convert file
917 0</computeroutput> in your CUPS error_log file. To have <quote>cups</quote> as a device in your Ghostscript,
918 you either need to patch GNU Ghostscript and recompile or use
919 <indexterm><primary>ESP</primary><secondary>Ghostscript</secondary></indexterm><ulink
920 url="http://www.cups.org/ghostscript.php">ESP Ghostscript</ulink>. The superior alternative is ESP
921 Ghostscript. It supports not just CUPS, but 300 other devices (while GNU Ghostscript supports only about 180).
922 Because of this broad output device support, ESP Ghostscript is the first choice for non-CUPS spoolers, too.
923 It is now recommended by Linuxprinting.org for all spoolers.
927 <indexterm><primary>cupsomatic</primary></indexterm>
928 <indexterm><primary>foomatic</primary></indexterm>
929 <indexterm><primary>foomatic-rip</primary></indexterm>
930 <indexterm><primary>ESP Ghostscript</primary></indexterm>
931 CUPS printers may be set up to use external rendering paths. One of the most common is provided by the
932 Foomatic/cupsomatic concept from <ulink url="http://www.linuxprinting.org/">Linuxprinting.org</ulink>. This
933 uses the classical Ghostscript approach, doing everything in one step. It does not use the
934 <quote>cups</quote> device, but one of the many others. However, even for Foomatic/cupsomatic usage, best
935 results and <indexterm><primary>ESP</primary><secondary>Ghostscript</secondary></indexterm> broadest printer
936 model support is provided by ESP Ghostscript (more about Foomatic/cupsomatic, particularly the new version
937 called now <emphasis>foomatic-rip</emphasis>, follows).
941 <title>MIME Types and CUPS Filters</title>
945 <indexterm><primary>MIME</primary><secondary>filters</secondary></indexterm>
946 <indexterm><primary>MIME</primary></indexterm>
947 <indexterm><primary>mime.types</primary></indexterm>
948 <indexterm><primary>application/pdf</primary></indexterm>
949 <indexterm><primary>autotyping</primary></indexterm>
950 CUPS reads the file <filename>/etc/cups/mime.types</filename> (and all other files carrying a
951 <filename>*.types</filename> suffix in the same directory) upon startup. These files contain the MIME type
952 recognition rules that are applied when CUPS runs its autotyping routines. The rule syntax is explained in the
953 man page for <filename>mime.types</filename> and in the comments section of the
954 <filename>mime.types</filename> file itself. A simple rule reads like this:
955 <indexterm><primary>application/pdf</primary></indexterm>
957 application/pdf pdf string(0,%PDF)
959 <indexterm><primary>%PDF</primary></indexterm>
960 <indexterm><primary>.pdf</primary></indexterm>
961 This means if a filename has a <filename>.pdf</filename> suffix or if the magic string
962 <emphasis>%PDF</emphasis> is right at the beginning of the file itself (offset 0 from the start), then it is a
963 PDF file (<parameter>application/pdf</parameter>). Another rule is this:
965 application/postscript ai eps ps string(0,%!) string(0,<04>%!)
967 <indexterm><primary>suffixes</primary></indexterm>
968 <indexterm><primary>.ai</primary></indexterm>
969 <indexterm><primary>.eps</primary></indexterm>
970 <indexterm><primary>.ps</primary></indexterm>
971 <indexterm><primary>generic PostScript</primary></indexterm>
972 <indexterm><primary>application/postscript</primary></indexterm>
973 If the filename has one of the suffixes <filename>.ai</filename>, <filename>.eps</filename>,
974 <filename>.ps</filename>, or if the file itself starts with one of the strings <emphasis>%!</emphasis> or
975 <emphasis><![CDATA[<04>%!]]></emphasis>, it is a generic PostScript file
976 (<parameter>application/postscript</parameter>).
980 <indexterm><primary>/etc/cups/</primary></indexterm>
981 Don't confuse the other mime.types files your system might be using
982 with the one in the <filename>/etc/cups/</filename> directory.
986 <indexterm><primary>application/postscript</primary></indexterm>
987 <indexterm><primary>PostScript</primary></indexterm>
988 <indexterm><primary>filter</primary></indexterm>
989 <indexterm><primary>PPD</primary></indexterm>
990 <indexterm><primary>transformation</primary></indexterm>
991 There is an important difference between two similar MIME types in CUPS: one is
992 <parameter>application/postscript</parameter>, the other is
993 <parameter>application/vnd.cups-postscript</parameter>. While <parameter>application/postscript</parameter> is
994 meant to be device-independent, job options for the file are still outside the PS file content, embedded in
995 command-line or environment variables by CUPS, <parameter>application/vnd.cups-postscript</parameter> may have
996 the job options inserted into the PostScript data itself (where applicable). The transformation of the generic
997 PostScript (<parameter>application/postscript</parameter>) to the device-specific version
998 (<parameter>application/vnd.cups-postscript</parameter>) is the responsibility of the CUPS
999 <parameter>pstops</parameter> filter. pstops uses information contained in the PPD to do the transformation.
1003 <indexterm><primary>ASCII</primary></indexterm>
1004 <indexterm><primary>HP-GL</primary></indexterm>
1005 <indexterm><primary>PDF</primary></indexterm>
1006 <indexterm><primary>PostScript</primary></indexterm>
1007 <indexterm><primary>DVI</primary></indexterm>
1008 <indexterm><primary>GIF</primary></indexterm>
1009 <indexterm><primary>PNG</primary></indexterm>
1010 <indexterm><primary>TIFF</primary></indexterm>
1011 <indexterm><primary>JPEG</primary></indexterm>
1012 <indexterm><primary>Photo-CD</primary></indexterm>
1013 <indexterm><primary>SUN-Raster</primary></indexterm>
1014 <indexterm><primary>PNM</primary></indexterm>
1015 <indexterm><primary>PBM</primary></indexterm>
1016 <indexterm><primary>SGI-RGB</primary></indexterm>
1017 <indexterm><primary>MIME</primary></indexterm>
1018 <indexterm><primary>filters</primary></indexterm>
1019 CUPS can handle ASCII text, HP-GL, PDF, PostScript, DVI, and
1020 many image formats (GIF, PNG, TIFF, JPEG, Photo-CD, SUN-Raster,
1021 PNM, PBM, SGI-RGB, and more) and their associated MIME types
1028 <title>MIME Type Conversion Rules</title>
1032 <indexterm><primary>MIME</primary></indexterm>
1033 <indexterm><primary>application/pdf</primary></indexterm>
1034 <indexterm><primary>/etc/cups/mime.convs</primary></indexterm>
1035 <indexterm><primary>application/pdf</primary></indexterm>
1036 <indexterm><primary>application/postscript</primary></indexterm>
1037 CUPS reads the file <filename>/etc/cups/mime.convs</filename>
1038 (and all other files named with a <filename>*.convs</filename>
1039 suffix in the same directory) upon startup. These files contain
1040 lines naming an input MIME type, an output MIME type, a format
1041 conversion filter that can produce the output from the input type,
1042 and virtual costs associated with this conversion. One example line
1045 application/pdf application/postscript 33 pdftops
1047 <indexterm><primary>pdftops</primary></indexterm>
1048 This means that the <parameter>pdftops</parameter> filter will take
1049 <parameter>application/pdf</parameter> as input and produce
1050 <parameter>application/postscript</parameter> as output; the virtual
1051 cost of this operation is 33 CUPS-$. The next filter is more
1052 expensive, costing 66 CUPS-$:
1053 <indexterm><primary>pdf</primary></indexterm>
1055 application/vnd.hp-HPGL application/postscript 66 hpgltops
1057 <indexterm><primary>hpgltops</primary></indexterm>
1058 This is the <parameter>hpgltops</parameter>, which processes HP-GL
1059 plotter files to PostScript.
1060 <indexterm><primary>application/octet-stream</primary></indexterm>
1062 application/octet-stream
1064 Here are two more examples:
1065 <indexterm><primary>text/plain</primary></indexterm>
1066 <indexterm><primary>application/x-shell</primary></indexterm>
1067 <indexterm><primary>text/plain</primary></indexterm>
1068 <indexterm><primary>texttops</primary></indexterm>
1070 application/x-shell application/postscript 33 texttops
1071 text/plain application/postscript 33 texttops
1073 <indexterm><primary>application/x-shell</primary></indexterm>
1074 The last two examples name the <parameter>texttops</parameter> filter to work on
1075 <parameter>text/plain</parameter> as well as on <parameter>application/x-shell</parameter>. (Hint: This
1076 differentiation is needed for the syntax highlighting feature of <parameter>texttops</parameter>).
1081 <title>Filtering Overview</title>
1084 <indexterm><primary>MIME</primary></indexterm>
1085 There are many more combinations named in <filename>mime.convs</filename>. However, you are not limited to use
1086 the ones predefined there. You can plug in any filter you like to the CUPS framework. It must meet, or must be
1087 made to meet, some minimal requirements. If you find (or write) a cool conversion filter of some kind, make
1088 sure it complies with what CUPS needs and put in the right lines in <filename>mime.types</filename> and
1089 <filename>mime.convs</filename>; then it will work seamlessly inside CUPS.
1093 <title>Filter Requirements</title>
1096 The <quote>CUPS requirements</quote> for filters are simple. Take filenames or <filename>stdin</filename> as
1097 input and write to <filename>stdout</filename>. They should take these arguments:
1101 <varlistentry><term>printer</term>
1103 The name of the printer queue (normally this is the name of the filter being run).
1107 <varlistentry><term>job</term>
1109 The numeric job ID for the job being printed.
1113 <varlistentry><term>user</term>
1115 The string from the originating-user-name attribute.
1119 <varlistentry><term>title</term>
1121 The string from the job-name attribute.
1125 <varlistentry><term>copies</term>
1127 The numeric value from the number-copies attribute.
1131 <varlistentry><term>options</term>
1137 <varlistentry><term>filename</term>
1139 (optionally) The print request file (if missing, filters expected data
1140 fed through <filename>stdin</filename>). In most cases, it is easy to
1141 write a simple wrapper script around existing filters to make them work with CUPS.
1151 <title>Prefilters</title>
1154 <indexterm><primary>PostScript</primary></indexterm>
1155 <indexterm><primary>non-PostScript printers</primary></indexterm>
1156 <indexterm><primary>raster</primary></indexterm>
1157 As previously stated, PostScript is the central file format to any UNIX-based
1158 printing system. From PostScript, CUPS generates raster data to feed
1159 non-PostScript printers.
1163 <indexterm><primary>prefilters</primary></indexterm>
1164 <indexterm><primary>PostScript</primary></indexterm>
1165 <indexterm><primary>ASCII text</primary></indexterm>
1166 <indexterm><primary>PDF</primary></indexterm>
1167 <indexterm><primary>DVI</primary></indexterm>
1168 <indexterm><primary>HP-GL.</primary></indexterm>
1169 <indexterm><primary>MIME type</primary></indexterm>
1170 <indexterm><primary>application/postscript</primary></indexterm>
1171 <indexterm><primary>pstops</primary></indexterm>
1172 <indexterm><primary>application/vnd.cups-postscript</primary></indexterm>
1173 But what happens if you send one of the supported non-PS formats to print? Then CUPS runs
1174 <quote>prefilters</quote> on these input formats to generate PostScript first. There are prefilters to create
1175 PostScript from ASCII text, PDF, DVI, or HP-GL. The outcome of these filters is always of MIME type
1176 <parameter>application/postscript</parameter> (meaning that any device-specific print options are not yet
1177 embedded into the PostScript by CUPS and that the next filter to be called is pstops). Another prefilter is
1178 running on all supported image formats, the <parameter>imagetops</parameter> filter. Its outcome is always of
1179 MIME type <parameter>application/vnd.cups-postscript</parameter> (not application/postscript), meaning it has
1180 the print options already embedded into the file. This is shown in <link linkend="4small">Prefiltering in
1181 CUPS to Form PostScript</link>.
1184 <figure id="4small">
1185 <title>Prefiltering in CUPS to Form PostScript.</title>
1186 <imagefile scale="25">4small</imagefile>
1192 <title>pstops</title>
1195 <indexterm><primary>pstops</primary></indexterm>
1196 <indexterm><primary>application/postscript</primary></indexterm>
1197 <indexterm><primary>application/vnd.cups-postscript</primary></indexterm>
1198 <indexterm><primary>output duplexing</primary></indexterm>
1199 <indexterm><primary>stapling</primary></indexterm>
1200 <indexterm><primary>punching</primary></indexterm>
1201 <indexterm><primary>PostScript</primary></indexterm>
1202 <emphasis>pstops</emphasis> is a filter that is used to convert <parameter>application/postscript</parameter> to
1203 <parameter>application/vnd.cups-postscript</parameter>. As stated earlier, this filter inserts all
1204 device-specific print options (commands to the printer to ask for the duplexing of output, or stapling and
1205 punching it, and so on) into the PostScript file. An example is illustrated in <link
1206 linkend="5small">Adding Device-Specific Print Options</link>.
1209 <figure id="5small">
1210 <title>Adding Device-Specific Print Options.</title>
1211 <imagefile scale="25">5small</imagefile>
1215 This is not all. Other tasks performed by it are:
1220 Selecting the range of pages to be printed (e.g., you can choose to
1221 print only pages <quote>3, 6, 8-11, 16, and 19-21</quote>, or only odd-numbered
1226 Putting two or more logical pages on one sheet of paper (the
1227 so-called <quote>number-up</quote> function).
1230 <listitem><para>Counting the pages of the job to insert the accounting
1231 information into the <filename>/var/log/cups/page_log</filename>.
1237 <title>pstoraster</title>
1240 <indexterm><primary>pstoraster</primary></indexterm>
1241 <indexterm><primary>rasterization</primary></indexterm>
1242 <indexterm><primary>raster drivers</primary></indexterm>
1243 <parameter>pstoraster</parameter> is at the core of the CUPS filtering system. It is responsible for the first
1244 stage of the rasterization process. Its input is of MIME type application/vnd.cups-postscript; its output is
1245 application/vnd.cups-raster. This output format is not yet meant to be printable. Its aim is to serve as a
1246 general-purpose input format for more specialized <emphasis>raster drivers</emphasis> that are able to
1247 generate device-specific printer data. This is shown in <link linkend="cups-raster">the PostScript to
1248 Intermediate Raster Format diagram</link>.
1251 <figure id="cups-raster">
1252 <title>PostScript to Intermediate Raster Format.</title>
1253 <imagefile scale="25">6small</imagefile>
1257 <indexterm><primary>CUPS raster</primary></indexterm>
1258 <indexterm><primary>generic raster</primary></indexterm>
1259 <indexterm><primary>IANA</primary></indexterm>
1260 <indexterm><primary>raster drivers</primary></indexterm>
1261 CUPS raster is a generic raster format with powerful features. It is able to include per-page information,
1262 color profiles, and more, to be used by the downstream raster drivers. Its MIME type is registered with IANA
1263 and its specification is, of course, completely open. It is designed to make it quite easy and inexpensive for
1264 manufacturers to develop Linux and UNIX raster drivers for their printer models should they choose to do so.
1265 CUPS always takes care of the first stage of rasterization so these vendors do not need to care about
1266 Ghostscript complications (in fact, there are currently more than one vendor financing the development of CUPS
1267 raster drivers). This is illustrated in <link linkend="cups-raster2">the CUPS-Raster Production Using
1268 Ghostscript illustration</link>.
1271 <figure id="cups-raster2">
1272 <title>CUPS-Raster Production Using Ghostscript.</title>
1273 <imagefile>7small</imagefile>
1277 <indexterm><primary>pstoraster</primary></indexterm>
1278 <indexterm><primary>GNU Ghostscript</primary></indexterm>
1279 <indexterm><primary>AFPL Ghostscript</primary></indexterm>
1280 <indexterm><primary>standalone filter</primary></indexterm>
1281 CUPS versions before version 1.1.15 shipped a binary (or source code) standalone filter, named
1282 <parameter>pstoraster</parameter>. <parameter>pstoraster</parameter>, which was derived from GNU Ghostscript
1283 5.50 and could be installed instead of and in addition to any GNU or AFPL Ghostscript package without
1288 Since version 1.1.15, this feature has changed. The functions for this filter have been integrated back
1289 into Ghostscript (now based on GNU Ghostscript version 7.05). The <parameter>pstoraster</parameter> filter is
1290 now a simple shell script calling <command>gs</command> with the <command>-sDEVICE=cups</command> parameter.
1291 If your Ghostscript fails when this command is executed: <command>gs -h |grep cups</command>, you might not
1292 be able to print, update your Ghostscript.
1297 <title>imagetops and imagetoraster</title>
1300 <indexterm><primary>prefilter</primary></indexterm>
1301 <indexterm><primary>imagetoraster</primary></indexterm>
1302 In the section about prefilters, we mentioned the prefilter
1303 that generates PostScript from image formats. The <parameter>imagetoraster</parameter>
1304 filter is used to convert directly from image to raster, without the
1305 intermediate PostScript stage. It is used more often than the previously
1306 mentioned prefilters. We summarize in a flowchart the image file
1307 filtering in <link linkend="small8">the Image Format to CUPS-Raster Format Conversion illustration</link>.
1310 <figure id="small8">
1311 <title>Image Format to CUPS-Raster Format Conversion.</title>
1312 <imagefile>8small</imagefile>
1318 <title>rasterto [printers specific]</title>
1321 <indexterm><primary>rastertoalps</primary></indexterm>
1322 <indexterm><primary>rastertobj</primary></indexterm>
1323 <indexterm><primary>rastertoepson</primary></indexterm>
1324 <indexterm><primary>rastertoescp</primary></indexterm>
1325 <indexterm><primary>rastertopcl</primary></indexterm>
1326 <indexterm><primary>rastertoturboprint</primary></indexterm>
1327 <indexterm><primary>rastertoescp</primary></indexterm>
1328 <indexterm><primary>rastertohp</primary></indexterm>
1329 <indexterm><primary>rastertoprinter</primary></indexterm>
1330 <indexterm><primary>rastertoprinter</primary></indexterm>
1331 <indexterm><primary>Gimp-Print</primary></indexterm>
1332 CUPS ships with quite a variety of raster drivers for processing CUPS raster. On my system, I find in
1333 /usr/lib/cups/filter/ the following: <parameter>rastertoalps</parameter>, <parameter>rastertobj</parameter>,
1334 <parameter>rastertoepson</parameter>, <parameter>rastertoescp</parameter>, <parameter>rastertopcl</parameter>,
1335 <parameter>rastertoturboprint</parameter>, <parameter>rastertoapdk</parameter>,
1336 <parameter>rastertodymo</parameter>, <parameter>rastertoescp</parameter>, <parameter>rastertohp</parameter>,
1337 and <parameter>rastertoprinter</parameter>. Don't worry if you have fewer drivers than this; some of these are
1338 installed by commercial add-ons to CUPS (like <parameter>rastertoturboprint</parameter>), and others (like
1339 <parameter>rastertoprinter</parameter>) by third-party driver development projects (such as Gimp-Print)
1340 wanting to cooperate as closely as possible with CUPS. See <link linkend="small9">the Raster to
1341 Printer-Specific Formats illustration</link>.
1344 <figure id="small9">
1345 <title>Raster to Printer-Specific Formats.</title>
1346 <imagefile>9small</imagefile>
1351 <title>CUPS Backends</title>
1354 <indexterm><primary>CUPS filtering chain</primary></indexterm>
1355 <indexterm><primary>print queue</primary></indexterm>
1356 The last part of any CUPS filtering chain is a backend. Backends
1357 are special programs that send the print-ready file to the final
1358 device. There is a separate backend program for any transfer
1359 protocol for sending print jobs over the network, and one for every local
1360 interface. Every CUPS print queue needs to have a CUPS <quote>device-URI</quote>
1361 associated with it. The device URI is the way to encode the backend
1362 used to send the job to its destination. Network device-URIs use
1363 two slashes in their syntax, local device URIs only one, as you can
1364 see from the following list. Keep in mind that local interface names
1365 may vary greatly from my examples, if your OS is not Linux:
1369 <varlistentry><term>usb</term>
1371 This backend sends print files to USB-connected printers. An
1372 example for the CUPS device-URI to use is
1373 <filename>usb:/dev/usb/lp0</filename>.
1374 </para></listitem></varlistentry>
1376 <varlistentry><term>serial</term>
1378 This backend sends print files to serially connected printers.
1379 An example for the CUPS device-URI to use is
1380 <filename>serial:/dev/ttyS0?baud=11500</filename>.
1381 </para></listitem></varlistentry>
1383 <varlistentry><term>parallel</term>
1385 This backend sends print files to printers connected to the
1386 parallel port. An example for the CUPS device-URI to use is
1387 <filename>parallel:/dev/lp0</filename>.
1388 </para></listitem></varlistentry>
1390 <varlistentry><term>SCSI</term>
1392 This backend sends print files to printers attached to the
1393 SCSI interface. An example for the CUPS device-URI to use is
1394 <filename>scsi:/dev/sr1</filename>.
1395 </para></listitem></varlistentry>
1397 <varlistentry><term>lpd</term>
1399 This backend sends print files to LPR/LPD-connected network
1400 printers. An example for the CUPS device-URI to use is
1401 <filename>lpd://remote_host_name/remote_queue_name</filename>.
1402 </para></listitem></varlistentry>
1404 <varlistentry><term>AppSocket/HP JetDirect</term>
1406 This backend sends print files to AppSocket (a.k.a., HP
1407 JetDirect) connected network printers. An example for the CUPS
1408 device-URI to use is
1409 <filename>socket://10.11.12.13:9100</filename>.
1410 </para></listitem></varlistentry>
1412 <varlistentry><term>ipp</term>
1414 This backend sends print files to IPP-connected network
1415 printers (or to other CUPS servers). Examples for CUPS device-URIs
1417 <filename>ipp:://192.193.194.195/ipp</filename>
1418 (for many HP printers) and
1419 <filename>ipp://remote_cups_server/printers/remote_printer_name</filename>.
1420 </para></listitem></varlistentry>
1422 <varlistentry><term>http</term>
1424 This backend sends print files to HTTP-connected printers.
1425 (The http:// CUPS backend is only a symlink to the ipp:// backend.)
1426 Examples for the CUPS device-URIs to use are
1427 <filename>http:://192.193.194.195:631/ipp</filename>
1428 (for many HP printers) and
1429 <filename>http://remote_cups_server:631/printers/remote_printer_name</filename>.
1430 </para></listitem></varlistentry>
1432 <varlistentry><term>smb</term>
1434 This backend sends print files to printers shared by a Windows
1435 host. Examples of CUPS device-URIs that may be used includes:
1440 <member><filename>smb://workgroup/server/printersharename</filename></member>
1441 <member><filename>smb://server/printersharename</filename></member>
1442 <member><filename>smb://username:password@workgroup/server/printersharename</filename></member>
1443 <member><filename>smb://username:password@server/printersharename</filename></member>
1448 The smb:// backend is a symlink to the Samba utility
1449 <parameter>smbspool</parameter> (does not ship with CUPS). If the
1450 symlink is not present in your CUPS backend directory, have your
1451 root user create it: <command>ln -s `which smbspool'
1452 /usr/lib/cups/backend/smb</command>.
1453 </para></listitem></varlistentry>
1457 It is easy to write your own backends as shell or Perl scripts if you
1458 need any modification or extension to the CUPS print system. One
1459 reason could be that you want to create <quote>special</quote> printers that send
1460 the print jobs as email (through a <quote>mailto:/</quote> backend), convert them to
1461 PDF (through a <quote>pdfgen:/</quote> backend) or dump them to <quote>/dev/null</quote>. (In
1462 fact, I have the systemwide default printer set up to be connected to
1463 a devnull:/ backend: there are just too many people sending jobs
1464 without specifying a printer, and scripts and programs that do not name
1465 a printer. The systemwide default deletes the job and sends a polite
1466 email back to the $USER asking him or her to always specify the correct
1471 <indexterm><primary>lpinfo</primary></indexterm>
1472 <indexterm><primary>CUPS backends</primary></indexterm>
1473 Not all of the mentioned backends may be present on your system or
1474 usable (depending on your hardware configuration). One test for all
1475 available CUPS backends is provided by the <emphasis>lpinfo</emphasis>
1476 utility. Used with the <option>-v</option> parameter, it lists
1477 all available backends:
1481 &prompt;<userinput>lpinfo -v</userinput>
1486 <title>The Role of <parameter>cupsomatic/foomatic</parameter></title>
1489 <indexterm><primary>cupsomatic</primary></indexterm>
1490 <indexterm><primary>foomatic</primary></indexterm>
1491 <indexterm><primary>PPDs</primary></indexterm>
1492 <indexterm><primary>Foomatic Printer</primary></indexterm>
1493 <indexterm><primary>Linuxprinting.org</primary></indexterm>
1494 <parameter>cupsomatic</parameter> filters may be the most widely used on CUPS
1495 installations. You must be clear that these were not
1496 developed by the CUPS people. They are a third-party add-on to
1497 CUPS. They utilize the traditional Ghostscript devices to render jobs
1498 for CUPS. When troubleshooting, you should know about the
1499 difference. Here the whole rendering process is done in one stage,
1500 inside Ghostscript, using an appropriate device for the target
1501 printer. <parameter>cupsomatic</parameter> uses PPDs that are generated from the Foomatic
1502 Printer & Driver Database at Linuxprinting.org.
1506 You can recognize these PPDs from the line calling the
1507 <parameter>cupsomatic</parameter> filter:
1509 *cupsFilter: "application/vnd.cups-postscript 0 cupsomatic"
1511 You may find this line among the first 40 or so lines of the PPD
1512 file. If you have such a PPD installed, the printer shows up in the
1513 CUPS Web interface with a <parameter>foomatic</parameter> namepart for
1514 the driver description. <parameter>cupsomatic</parameter> is a Perl script that runs
1515 Ghostscript with all the complicated command-line options
1516 autoconstructed from the selected PPD and command line options give to
1521 <indexterm><primary>point'n'print</primary></indexterm>
1522 <indexterm><primary>foomatic-rip</primary></indexterm>
1523 <indexterm><primary>Adobe specifications</primary></indexterm>
1524 <indexterm><primary>hi-res photo</primary></indexterm>
1525 <indexterm><primary>normal color</primary></indexterm>
1526 <indexterm><primary>grayscale</primary></indexterm>
1527 <indexterm><primary>draft</primary></indexterm>
1528 <indexterm><primary>media type</primary></indexterm>
1529 <indexterm><primary>resolution</primary></indexterm>
1530 <indexterm><primary>inktype</primary></indexterm>
1531 <indexterm><primary>dithering algorithm</primary></indexterm>
1532 However, <parameter>cupsomatic</parameter> is now deprecated. Its PPDs (especially the first
1533 generation of them, still in heavy use out there) are not meeting the
1534 Adobe specifications. You might also suffer difficulties when you try
1535 to download them with <quote>Point'n'Print</quote> to Windows clients. A better
1536 and more powerful successor is now in a stable beta-version: it is called <parameter>foomatic-rip</parameter>. To use
1537 <parameter>foomatic-rip</parameter> as a filter with CUPS, you need the new type of PPDs, which
1538 have a similar but different line:
1540 *cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
1542 The PPD-generating engine at Linuxprinting.org has been revamped.
1543 The new PPDs comply with the Adobe spec. They also provide a
1544 new way to specify different quality levels (hi-res photo, normal
1545 color, grayscale, and draft) with a single click, whereas before you
1546 could have required five or more different selections (media type,
1547 resolution, inktype, and dithering algorithm). There is support for
1548 custom-size media built in. There is support to switch
1549 print options from page to page in the middle of a job. And the
1550 best thing is that the new <constant>foomatic-rip</constant> works seamlessly with all
1551 legacy spoolers too (like LPRng, BSD-LPD, PDQ, PPR, and so on), providing
1552 for them access to use PPDs for their printing.
1557 <title>The Complete Picture</title>
1560 If you want to see an overview of all the filters and how they
1561 relate to each other, the complete picture of the puzzle is at the end
1567 <title><filename>mime.convs</filename></title>
1570 CUPS autoconstructs all possible filtering chain paths for any given
1571 MIME type and every printer installed. But how does it decide in
1572 favor of or against a specific alternative? (There may be cases
1573 where there is a choice of two or more possible filtering chains for
1574 the same target printer.) Simple. You may have noticed the figures in
1575 the third column of the mime.convs file. They represent virtual costs
1576 assigned to this filter. Every possible filtering chain will sum up to
1577 a total <quote>filter cost.</quote> CUPS decides for the most <quote>inexpensive</quote> route.
1581 <indexterm><primary>cupsd.conf</primary></indexterm>
1582 <indexterm><primary>FilterLimit</primary></indexterm>
1583 Setting <parameter>FilterLimit 1000</parameter> in
1584 <filename>cupsd.conf</filename> will not allow more filters to
1585 run concurrently than will consume a total of 1000 virtual filter
1586 cost. This is an efficient way to limit the load of any CUPS
1587 server by setting an appropriate <quote>FilterLimit</quote> value. A FilterLimit of
1588 200 allows roughly one job at a time, while a FilterLimit of 1000 allows
1589 approximately five jobs maximum at a time.
1594 <title><quote>Raw</quote> Printing</title>
1597 <indexterm><primary>PPD</primary></indexterm>
1598 <indexterm><primary>lpadmin</primary></indexterm>
1599 <indexterm><primary>rawprinter</primary></indexterm>
1600 You can tell CUPS to print (nearly) any file <quote>raw</quote>. <quote>Raw</quote> means it will not be
1601 filtered. CUPS will send the file to the printer <quote>as is</quote> without bothering if the printer is able
1602 to digest it. Users need to take care themselves that they send sensible data formats only. Raw printing can
1603 happen on any queue if the <quote><parameter>-o raw</parameter></quote> option is specified on the command
1604 line. You can also set up raw-only queues by simply not associating any PPD with it. This command:
1606 &prompt;<userinput>lpadmin -P rawprinter -v socket://11.12.13.14:9100 -E</userinput>
1608 sets up a queue named <quote>rawprinter</quote>, connected via the <quote>socket</quote> protocol (a.k.a.
1609 <quote>HP JetDirect</quote>) to the device at IP address 11.12.1.3.14, using port 9100. (If you had added a
1610 PPD with <command>-P /path/to/PPD</command> to this command line, you would have installed a
1611 <quote>normal</quote> print queue.)
1615 CUPS will automatically treat each job sent to a queue as a <quote>raw</quote> one
1616 if it can't find a PPD associated with the queue. However, CUPS will
1617 only send known MIME types (as defined in its own mime.types file) and
1623 <title>application/octet-stream Printing</title>
1626 <indexterm><primary>/etc/cups/mime.types</primary></indexterm>
1627 <indexterm><primary>application/octet-stream</primary></indexterm>
1628 Any MIME type with no rule in the <filename>/etc/cups/mime.types</filename> file is regarded as unknown
1629 or <parameter>application/octet-stream</parameter> and will not be
1630 sent. Because CUPS refuses to print unknown MIME types by default,
1631 you will probably have experienced that print jobs originating
1632 from Windows clients were not printed. You may have found an error
1633 message in your CUPS logs like:
1636 <para><computeroutput>
1637 Unable to convert file 0 to printable format for job
1638 </computeroutput></para>
1641 To enable the printing of <parameter>application/octet-stream</parameter> files, edit
1646 <listitem><para><filename>/etc/cups/mime.convs</filename></para></listitem>
1648 <listitem><para><filename>/etc/cups/mime.types</filename></para></listitem>
1652 <indexterm><primary>raw mode</primary></indexterm>
1653 Both contain entries (at the end of the respective files) that must be uncommented to allow raw mode
1654 operation for <parameter>application/octet-stream</parameter>. In <filename>/etc/cups/mime.types</filename>
1655 make sure this line is present:
1656 <indexterm><primary>application/octet-stream</primary></indexterm>
1658 application/octet-stream
1660 This line (with no specific autotyping rule set) makes all files
1661 not otherwise auto-typed a member of <parameter>application/octet-stream</parameter>. In
1662 <filename>/etc/cups/mime.convs</filename>, have this
1665 application/octet-stream application/vnd.cups-raw 0 -
1667 <indexterm><primary>MIME</primary></indexterm>
1668 This line tells CUPS to use the <emphasis>Null Filter</emphasis>
1669 (denoted as <quote>-</quote>, doing nothing at all) on
1670 <parameter>application/octet-stream</parameter>, and tag the result as
1671 <parameter>application/vnd.cups-raw</parameter>. This last one is
1672 always a green light to the CUPS scheduler to now hand the file over
1673 to the backend connecting to the printer and sending it over.
1677 Editing the <filename>mime.convs</filename> and the <filename>mime.types</filename> file does not
1678 <emphasis>enforce</emphasis> <quote>raw</quote> printing, it only <emphasis>allows</emphasis> it.
1682 <title>Background</title>
1685 <indexterm><primary>security-aware</primary></indexterm>
1686 <indexterm><primary>MIME type</primary></indexterm>
1687 <indexterm><primary>/etc/cups/mime.types</primary></indexterm>
1688 <indexterm><primary>/etc/cups/mime.convs</primary></indexterm>
1689 That CUPS is a more security-aware printing system than traditional ones
1690 does not by default allow one to send deliberate (possibly binary)
1691 data to printing devices. (This could be easily abused to launch a
1692 Denial of Service attack on your printer(s), causing at least the loss
1693 of a lot of paper and ink.) <quote>Unknown</quote> data are regarded by CUPS
1694 as <emphasis>MIME type</emphasis> <emphasis>application/octet-stream</emphasis>. While you
1695 <emphasis>can</emphasis> send data <quote>raw</quote>, the MIME type for these must
1696 be one that is known to CUPS and allowed by it. The file
1697 <filename>/etc/cups/mime.types</filename> defines the <quote>rules</quote> of how CUPS
1698 recognizes MIME types. The file <filename>/etc/cups/mime.convs</filename> decides which file
1699 conversion filter(s) may be applied to which MIME types.
1705 <title>PostScript Printer Descriptions for Non-PostScript Printers</title>
1708 <indexterm><primary>PPD</primary></indexterm>
1709 <indexterm><primary>non-PostScript</primary></indexterm>
1710 <indexterm><primary>PostScript</primary></indexterm>
1711 <indexterm><primary>RIP</primary></indexterm>
1712 <indexterm><primary>Ghostscript</primary></indexterm>
1713 <indexterm><primary>device-specific commands</primary></indexterm>
1714 Originally PPDs were meant to be used for PostScript printers
1715 only. Here, they help to send device-specific commands and settings
1716 to the RIP, which processes the job file. CUPS has extended this
1717 scope for PPDs to cover non-PostScript printers too. This was not
1718 difficult, because it is a standardized file format. In a way
1719 it was logical too: CUPS handles PostScript and uses a PostScript
1720 RIP (Ghostscript) to process the job files. The only difference is that
1721 a PostScript printer has the RIP built-in, for other types of
1722 printers the Ghostscript RIP runs on the host computer.
1726 PPDs for a non-PostScript printer have a few lines that are unique to
1727 CUPS. The most important one looks similar to this:
1728 <indexterm><primary>application/vnd.cups-raster</primary></indexterm>
1730 *cupsFilter: application/vnd.cups-raster 66 rastertoprinter
1732 It is the last piece in the CUPS filtering puzzle. This line tells the
1733 CUPS daemon to use as a last filter <parameter>rastertoprinter</parameter>. This filter
1734 should be served as input an <parameter>application/vnd.cups-raster</parameter> MIME type
1735 file. Therefore, CUPS should autoconstruct a filtering chain, which
1736 delivers as its last output the specified MIME type. This is then
1737 taken as input to the specified <parameter>rastertoprinter</parameter> filter. After
1738 the last filter has done its work (<parameter>rastertoprinter</parameter> is a Gimp-Print
1739 filter), the file should go to the backend, which sends it to the
1744 CUPS by default ships only a few generic PPDs, but they are good for
1745 several hundred printer models. You may not be able to control
1746 different paper trays, or you may get larger margins than your
1747 specific model supports. See Table 21.1<link linkend="cups-ppds"></link> for summary information.
1750 <table frame="all" id="cups-ppds">
1751 <title>PPDs Shipped with CUPS</title>
1752 <tgroup cols="2" align="left">
1753 <colspec align="left"/>
1754 <colspec align="justify" colwidth="1*"/>
1755 <thead><row><entry>PPD file</entry><entry>Printer type</entry></row></thead>
1757 <row><entry>deskjet.ppd</entry><entry>older HP inkjet printers and compatible</entry></row>
1759 <row><entry>deskjet2.ppd</entry> <entry>newer HP inkjet printers and compatible </entry> </row>
1761 <row><entry>dymo.ppd</entry> <entry>label printers </entry> </row>
1763 <row><entry>epson9.ppd</entry> <entry>Epson 24-pin impact printers and compatible </entry> </row>
1765 <row><entry>epson24.ppd</entry> <entry>Epson 24-pin impact printers and compatible </entry> </row>
1767 <row><entry>okidata9.ppd</entry> <entry>Okidata 9-pin impact printers and compatible </entry> </row>
1769 <row><entry>okidat24.ppd</entry> <entry>Okidata 24-pin impact printers and compatible </entry> </row>
1771 <row><entry>stcolor.ppd</entry> <entry>older Epson Stylus Color printers </entry> </row>
1773 <row><entry>stcolor2.ppd</entry> <entry>newer Epson Stylus Color printers </entry> </row>
1775 <row><entry>stphoto.ppd</entry> <entry>older Epson Stylus Photo printers </entry> </row>
1777 <row><entry>stphoto2.ppd</entry> <entry>newer Epson Stylus Photo printers </entry> </row>
1779 <row><entry>laserjet.ppd</entry> <entry>all PCL printers </entry> </row>
1788 <title><emphasis>cupsomatic/foomatic-rip</emphasis> Versus <emphasis>Native CUPS</emphasis> Printing</title>
1791 <indexterm><primary>cupsomatic</primary></indexterm>
1792 <indexterm><primary>foomatic-rip</primary></indexterm>
1793 Native CUPS rasterization works in two steps:
1798 <indexterm><primary>pstoraster</primary></indexterm>
1799 First is the <parameter>pstoraster</parameter> step. It uses the special CUPS
1800 <indexterm><primary>ESP</primary><secondary>Ghostscript</secondary></indexterm>
1801 device from ESP Ghostscript 7.05.x as its tool.
1805 Second is the <parameter>rasterdriver</parameter> step. It uses various
1806 device-specific filters; there are several vendors who provide good
1807 quality filters for this step. Some are free software, some are
1808 shareware, and some are proprietary.
1813 Often this produces better quality (and has several more advantages) than other methods.
1814 This is shown in <link linkend="cupsomatic-dia"> the cupsomatic/foomatic Processing Versus Native CUPS
1815 illustration</link>.
1818 <figure id="cupsomatic-dia">
1819 <title>cupsomatic/foomatic Processing Versus Native CUPS.</title>
1820 <imagefile>10small</imagefile>
1824 One other method is the <parameter>cupsomatic/foomatic-rip</parameter>
1825 way. Note that <parameter>cupsomatic</parameter> is <emphasis>not</emphasis> made by the CUPS
1826 developers. It is an independent contribution to printing development,
1827 made by people from Linuxprinting.org.<footnote><para>See also <ulink
1828 noescape="1" url="http://www.cups.org/cups-help.html">http://www.cups.org/cups-help.html</ulink></para></footnote>
1829 <parameter>cupsomatic</parameter> is no longer developed, maintained, or supported. It now been
1830 replaced by <parameter>foomatic-rip</parameter>. <parameter>foomatic-rip</parameter> is a complete rewrite
1831 of the old <parameter>cupsomatic</parameter> idea, but very much improved and generalized to
1832 other (non-CUPS) spoolers. An upgrade to <parameter>foomatic-rip</parameter> is strongly
1833 advised, especially if you are upgrading to a recent version of CUPS,
1838 <indexterm><primary>cupsomatic</primary></indexterm>
1839 <indexterm><primary>foomatic</primary></indexterm>
1840 Like the old <parameter>cupsomatic</parameter> method, the <parameter>foomatic-rip</parameter> (new) method
1841 from Linuxprinting.org uses the traditional Ghostscript print file processing, doing everything in a single
1842 step. It therefore relies on all the other devices built into Ghostscript. The quality is as good (or bad) as
1843 Ghostscript rendering is in other spoolers. The advantage is that this method supports many printer models not
1844 supported (yet) by the more modern CUPS method.
1848 Of course, you can use both methods side by side on one system (and even for one printer, if you set up
1849 different queues) and find out which works best for you.
1853 <indexterm><primary>cupsomatic</primary></indexterm>
1854 <indexterm><primary>pstoraster</primary></indexterm>
1855 <indexterm><primary>rastertosomething</primary></indexterm>
1856 <indexterm><primary>rasterization</primary></indexterm>
1857 <indexterm><primary>Foomatic/cupsomatic</primary></indexterm>
1858 <indexterm><primary>rendering</primary></indexterm>
1859 <parameter>cupsomatic</parameter> kidnaps the print file after the
1860 <parameter>application/vnd.cups-postscript</parameter> stage and deviates it through the CUPS-external,
1861 systemwide Ghostscript installation. Therefore, the print file bypasses the <parameter>pstoraster</parameter>
1862 filter (and also bypasses the CUPS raster drivers <parameter>rastertosomething</parameter>). After Ghostscript
1863 finished its rasterization, <parameter>cupsomatic</parameter> hands the rendered file directly to the CUPS
1864 backend. <link linkend="cupsomatic-dia">cupsomatic/foomatic Processing Versus Native
1865 CUPS</link>, illustrates the difference between native CUPS rendering and the
1866 <parameter>Foomatic/cupsomatic</parameter> method.
1871 <title>Examples for Filtering Chains</title>
1874 Here are a few examples of commonly occurring filtering chains to
1875 illustrate the workings of CUPS.
1879 <indexterm><primary>HP JetDirect</primary></indexterm>
1880 <indexterm><primary>PostScript</primary></indexterm>
1881 <indexterm><primary>two-up</primary></indexterm>
1882 <indexterm><primary>duplex</primary></indexterm>
1883 Assume you want to print a PDF file to an HP JetDirect-connected
1884 PostScript printer, but you want to print pages 3-5, 7, and 11-13
1885 only, and you want to print them <quote>two-up</quote> and <quote>duplex</quote>:
1889 <listitem><para>Your print options (page selection as required, two-up,
1890 duplex) are passed to CUPS on the command line.</para></listitem>
1892 <listitem><para>The (complete) PDF file is sent to CUPS and autotyped as
1893 <parameter>application/pdf</parameter>.</para></listitem>
1895 <listitem><para>The file therefore must first pass the
1896 <parameter>pdftops</parameter> prefilter, which produces PostScript
1897 MIME type <parameter>application/postscript</parameter> (a preview here
1898 would still show all pages of the original PDF).</para></listitem>
1900 <listitem><para>The file then passes the <parameter>pstops</parameter>
1901 filter that applies the command-line options: it selects pages
1902 2-5, 7, and 11-13, creates the imposed layout <quote>two pages on one sheet</quote>, and
1903 inserts the correct <quote>duplex</quote> command (as defined in the printer's
1904 PPD) into the new PostScript file; the file is now of PostScript MIME
1906 <parameter>application/vnd.cups-postscript</parameter>.</para></listitem>
1908 <listitem><para>The file goes to the <parameter>socket</parameter>
1909 backend, which transfers the job to the printers.</para></listitem>
1913 The resulting filter chain, therefore, is as shown in <link linkend="pdftosocket">the PDF to socket chain
1914 illustration</link>.
1917 <indexterm><primary>pdftosocket</primary></indexterm>
1918 <figure id="pdftosocket">
1919 <title>PDF to Socket Chain.</title>
1920 <imagefile>pdftosocket</imagefile>
1924 <indexterm><primary>USB</primary></indexterm>
1925 <indexterm><primary>Epson Stylus</primary></indexterm>
1926 <indexterm><primary>stphoto2.ppd</primary></indexterm>
1927 Assume you want to print the same filter to an USB-connected Epson Stylus Photo Printer installed with the CUPS
1928 <filename>stphoto2.ppd</filename>. The first few filtering stages are nearly the same:
1933 Your print options (page selection as required, two-up,
1934 duplex) are passed to CUPS on the command line.
1938 The (complete) PDF file is sent to CUPS and autotyped as
1939 <parameter>application/pdf</parameter>.
1943 <indexterm><primary>pdftops</primary></indexterm>
1944 <indexterm><primary>PDF</primary></indexterm>
1945 The file must first pass the <parameter>pdftops</parameter> prefilter, which produces PostScript
1946 MIME type <parameter>application/postscript</parameter> (a preview here would still show all
1947 pages of the original PDF).
1951 <indexterm><primary>pstops</primary></indexterm>
1952 <indexterm><primary>duplex printing</primary></indexterm>
1953 The file then passes the <quote>pstops</quote> filter that applies
1954 the command-line options: it selects the pages 2-5, 7, and 11-13,
1955 creates the imposed layout <quote>two pages on one sheet,</quote> and inserts the
1956 correct <quote>duplex</quote> command (oops &smbmdash; this printer and PPD
1957 do not support duplex printing at all, so this option will
1958 be ignored) into the new PostScript file; the file is now of PostScript
1959 MIME type <parameter>application/vnd.cups-postscript</parameter>.
1963 The file then passes the <parameter>pstoraster</parameter> stage and becomes MIME type
1964 <parameter>application/cups-raster</parameter>.
1968 <indexterm><primary>rastertoepson</primary></indexterm>
1969 Finally, the <parameter>rastertoepson</parameter> filter
1970 does its work (as indicated in the printer's PPD), creating the
1971 printer-specific raster data and embedding any user-selected
1972 print options into the print data stream.
1976 The file goes to the <parameter>usb</parameter> backend, which transfers the job to the printers.
1981 The resulting filter chain therefore is as shown in <link linkend="pdftoepsonusb">the PDF to USB Chain
1982 illustration</link>.
1985 <figure id="pdftoepsonusb">
1986 <title>PDF to USB Chain.</title>
1987 <imagefile>pdftoepsonusb</imagefile>
1992 <title>Sources of CUPS Drivers/PPDs</title>
1995 On the Internet you can now find many thousands of CUPS-PPD files
1996 (with their companion filters), in many national languages
1997 supporting more than 1,000 non-PostScript models.
2001 <indexterm><primary>ESP</primary><secondary>Print Pro</secondary></indexterm>
2002 <indexterm><primary>PrintPro</primary><see>ESP Print Pro</see></indexterm>
2004 <ulink url="http://www.easysw.com/printpro/">ESP PrintPro</ulink>
2005 (commercial, non-free) is packaged with more than 3,000 PPDs, ready for
2006 successful use <quote>out of the box</quote> on Linux, Mac OS X, IBM-AIX,
2007 HP-UX, Sun-Solaris, SGI-IRIX, Compaq Tru64, Digital UNIX, and
2008 other commercial Unices (it is written by the CUPS developers
2009 themselves and its sales help finance the further development of
2010 CUPS, as they feed their creators).
2014 The <ulink url="http://gimp-print.sourceforge.net/">Gimp-Print Project</ulink>
2015 (GPL, free software) provides around 140 PPDs (supporting nearly 400 printers, many driven
2016 to photo quality output), to be used alongside the Gimp-Print CUPS filters.
2020 <ulink url="http://www.turboprint.de/english.html/">TurboPrint </ulink> (shareware, non-free) supports
2021 roughly the same number of printers in excellent quality.
2025 <ulink url="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/">OMNI </ulink>
2026 (LPGL, free) is a package made by IBM, now containing support for more
2027 than 400 printers, stemming from the inheritance of IBM OS/2 know-how
2028 ported over to Linux (CUPS support is in a beta stage at present).
2032 <ulink url="http://hpinkjet.sourceforge.net/">HPIJS </ulink> (BSD-style licenses, free)
2033 supports approximately 150 of HP's own printers and also provides
2034 excellent print quality now (currently available only via the Foomatic path).
2038 <ulink url="http://www.linuxprinting.org/">Foomatic/cupsomatic </ulink>
2039 (LPGL, free) from Linuxprinting.org provide PPDs for practically every Ghostscript
2040 filter known to the world (including Omni, Gimp-Print, and HPIJS).
2047 <title>Printing with Interface Scripts</title>
2050 <indexterm><primary>PCL</primary></indexterm>
2051 <indexterm><primary>lpadmin</primary></indexterm>
2052 CUPS also supports the use of <quote>interface scripts</quote> as known from
2053 System V AT&T printing systems. These are often used for PCL
2054 printers, from applications that generate PCL print jobs. Interface
2055 scripts are specific to printer models. They have a role similar to
2056 PPDs for PostScript printers. Interface scripts may inject the Escape
2057 sequences as required into the print data stream if the user, for example, selects
2058 a certain paper tray, or changes paper orientation, or uses A3
2059 paper. Interface scripts are practically unknown in the Linux
2060 realm. On HP-UX platforms they are more often used. You can use any
2061 working interface script on CUPS too. Just install the printer with
2062 the <command>-i</command> option:
2064 &rootprompt;<userinput>lpadmin -p pclprinter -v socket://11.12.13.14:9100 \
2065 -i /path/to/interface-script</userinput>
2069 Interface scripts might be the <quote>unknown animal</quote> to many. However,
2070 with CUPS they provide the easiest way to plug in your own custom-written filtering
2071 script or program into one specific print queue (some information about the traditional
2072 use of interface scripts is found at
2073 <ulink noescape="1" url="http://playground.sun.com/printing/documentation/interface.html">
2074 http://playground.sun.com/printing/documentation/interface.html</ulink>).
2080 <title>Network Printing (Purely Windows)</title>
2083 Network printing covers a lot of ground. To understand what exactly
2084 goes on with Samba when it is printing on behalf of its Windows
2085 clients, let's first look at a <quote>purely Windows</quote> setup: Windows clients
2086 with a Windows NT print server.
2090 <title>From Windows Clients to an NT Print Server</title>
2093 Windows clients printing to an NT-based print server have two
2095 <indexterm><primary>GDI</primary></indexterm>
2096 <indexterm><primary>EMF</primary></indexterm>
2101 <listitem><para>Execute the driver locally and render the GDI output
2102 (EMF) into the printer-specific format on their own.
2105 <listitem><para>Send the GDI output (EMF) to the server, where the
2106 driver is executed to render the printer-specific output.
2111 Both print paths are shown in the flowcharts in <link linkend="small11">
2112 Print Driver Execution on the Client</link>, and
2113 <link linkend="small12">Print Driver Execution on the Server</link>.
2118 <title>Driver Execution on the Client</title>
2121 In the first case, the print server must spool the file as raw, meaning it shouldn't touch the job file and try
2122 to convert it in any way. This is what a traditional UNIX-based print server can do too, and at a better
2123 performance and more reliably than an NT print server. This is what most Samba administrators probably are
2124 familiar with. One advantage of this setup is that this <quote>spooling-only</quote> print server may be used
2125 even if no driver(s) for UNIX is available. It is sufficient to have the Windows client drivers available and
2126 installed on the clients. This is illustrated in <link linkend="small11">the Print Driver Execution on the
2127 Client diagram</link>.
2130 <figure id="small11">
2131 <title>Print Driver Execution on the Client.</title>
2132 <imagefile>11small</imagefile>
2138 <title>Driver Execution on the Server</title>
2142 <indexterm><primary>PostScript</primary></indexterm>
2143 <indexterm><primary>PCL</primary></indexterm>
2144 <indexterm><primary>ESC/P</primary></indexterm>
2145 <indexterm><primary>EMF</primary></indexterm>
2146 <indexterm><primary>GDI</primary></indexterm>
2147 The other path executes the printer driver on the server. The client transfers print files in EMF format to
2148 the server. The server uses the PostScript, PCL, ESC/P, or other driver to convert the EMF file into the
2149 printer-specific language. It is not possible for UNIX to do the same. Currently, there is no program or
2150 method to convert a Windows client's GDI output on a UNIX server into something a printer could understand.
2151 This is illustrated in <link linkend="small12">the Print Driver Execution on the Server diagram</link>.
2154 <figure id="small12">
2155 <title>Print Driver Execution on the Server.</title>
2156 <imagefile>12small</imagefile>
2160 However, something similar is possible with CUPS, so read on.
2166 <title>Network Printing (Windows Clients and UNIX/Samba Print
2170 Since UNIX print servers <emphasis>cannot</emphasis> execute the Win32
2171 program code on their platform, the picture is somewhat
2172 different. However, this does not limit your options all that
2173 much. On the contrary, you may have a way here to implement printing
2174 features that are not possible otherwise.
2178 <title>From Windows Clients to a CUPS/Samba Print Server</title>
2181 Here is a simple recipe showing how you can take advantage of CUPS's
2182 powerful features for the benefit of your Windows network printing
2187 <listitem><para>Let the Windows clients send PostScript to the CUPS
2188 server.</para></listitem>
2190 <listitem><para>Let the CUPS server render the PostScript into device-specific raster format.</para></listitem>
2194 This requires the clients to use a PostScript driver (even if the
2195 printer is a non-PostScript model. It also requires that you have a
2196 driver on the CUPS server.
2200 First, to enable CUPS-based printing through Samba, the following options should be set in your &smb.conf;
2201 file <parameter>[global]</parameter> section:
2205 <smbconfoption name="printing">cups</smbconfoption>
2206 <smbconfoption name="printcap">cups</smbconfoption>
2210 When these parameters are specified, all manually set print directives (like <smbconfoption name="print
2211 command"/> or <smbconfoption name="lppause command"/>) in &smb.conf; (as well as in Samba itself) will be
2212 ignored. Instead, Samba will directly interface with CUPS through its application program interface (API), as
2213 long as Samba has been compiled with CUPS library (libcups) support. If Samba has not been compiled with CUPS
2214 support, and if no other print commands are set up, then printing will use the <emphasis>System V</emphasis>
2215 AT&T command set, with the -oraw option automatically passing through (if you want your own defined print
2216 commands to work with a Samba server that has CUPS support compiled in, simply use <smbconfoption
2217 name="classicalprinting">sysv</smbconfoption>). This is illustrated in <link linkend="13small">the Printing via
2218 CUPS/Samba Server diagram</link>.
2221 <figure id="13small">
2222 <title>Printing via CUPS/Samba Server.</title>
2223 <imagefile>13small</imagefile>
2228 <title>Samba Receiving Job-Files and Passing Them to CUPS</title>
2231 Samba <emphasis>must</emphasis> use its own spool directory (it is set by a line similar to <smbconfoption
2232 name="path">/var/spool/samba</smbconfoption>, in the <smbconfsection name="[printers]"/> or <smbconfsection
2233 name="[printername]"/> section of &smb.conf;). Samba receives the job in its own spool space and passes it
2234 into the spool directory of CUPS (the CUPS spool directory is set by the <parameter>RequestRoot</parameter>
2235 directive in a line that defaults to <parameter>RequestRoot /var/spool/cups</parameter>). CUPS checks the
2236 access rights of its spool directory and resets it to healthy values with every restart. We have seen quite a
2237 few people who used a common spooling space for Samba and CUPS, and struggled for weeks with this
2238 <quote>problem.</quote>
2242 A Windows user authenticates only to Samba (by whatever means is
2243 configured). If Samba runs on the same host as CUPS, you only need to
2244 allow <quote>localhost</quote> to print. If it runs on different machines, you
2245 need to make sure the Samba host gets access to printing on CUPS.
2251 <title>Network PostScript RIP</title>
2254 This section discusses the use of CUPS filters on the server &smbmdash; configuration where
2255 clients make use of a PostScript driver with CUPS-PPDs.
2260 <indexterm><primary>PostScript</primary></indexterm>
2261 <indexterm><primary>PCL</primary></indexterm>
2262 <indexterm><primary>PJL</primary></indexterm>
2263 PPDs can control all print device options. They are usually provided by the manufacturer &smbmdash; if you own
2264 a PostScript printer, that is. PPD files are always a component of PostScript printer drivers on MS Windows or
2265 Apple Mac OS systems. They are ASCII files containing user-selectable print options, mapped to appropriate
2266 PostScript, PCL, or PJL commands for the target printer. Printer driver GUI dialogs translate these options
2267 <quote>on the fly</quote> into buttons and drop-down lists for the user to select.
2271 CUPS can load, without any conversions, the PPD file from any Windows (NT is recommended) PostScript driver
2272 and handle the options. There is a Web browser interface to the print options (select <ulink noescape="1"
2273 url="http://localhost:631/printers/">http://localhost:631/printers/</ulink> and click on one
2274 <guibutton>Configure Printer</guibutton> button to see it) or a command-line interface (see <command>man
2275 lpoptions</command> or see if you have <command>lphelp</command> on your system). There are also some
2276 different GUI front-ends on Linux/UNIX, which can present PPD options to users. PPD options are normally meant
2277 to be evaluated by the PostScript RIP on the real PostScript printer.
2281 <title>PPDs for Non-PS Printers on UNIX</title>
2285 <indexterm><primary>PPD</primary></indexterm>
2286 CUPS does not limit itself to <quote>real</quote> PostScript printers in its use of PPDs. The CUPS developers
2287 have extended the scope of the PPD concept to also describe available device and driver options for
2288 non-PostScript printers through CUPS-PPDs.
2292 This is logical, because CUPS includes a fully featured PostScript interpreter (RIP). This RIP is based on
2293 Ghostscript. It can process all received PostScript (and additionally many other file formats) from clients.
2294 All CUPS-PPDs geared to non-PostScript printers contain an additional line, starting with the keyword
2295 <parameter>*cupsFilter</parameter>. This line tells the CUPS print system which printer-specific filter to use
2296 for the interpretation of the supplied PostScript. Thus CUPS lets all its printers appear as PostScript
2297 devices to its clients, because it can act as a PostScript RIP for those printers, processing the received
2298 PostScript code into a proper raster print format.
2303 <title>PPDs for Non-PS Printers on Windows</title>
2306 <indexterm><primary>PPD</primary></indexterm>
2307 CUPS-PPDs can also be used on Windows clients, on top of a <quote>core</quote> PostScript driver (now
2308 recommended is the CUPS PostScript Driver for Windows NT/200x/XP; you can also use the Adobe one, with
2309 limitations). This feature enables CUPS to do a few tricks no other spooler can do:
2314 Act as a networked PostScript RIP handling print files from all client platforms in a uniform way.
2318 Act as a central accounting and billing server, since all files are passed through the pstops filter and are therefore
2319 logged in the CUPS <filename>page_log</filename> file. <emphasis>Note:</emphasis> this cannot happen with
2320 <quote>raw</quote> print jobs, which always remain unfiltered per definition.
2324 Enable clients to consolidate on a single PostScript driver, even for many different target printers.
2329 Using CUPS PPDs on Windows clients enables them to control all print job settings just as a UNIX client can do.
2335 <title>Windows Terminal Servers (WTS) as CUPS Clients</title>
2338 This setup may be of special interest to people experiencing major problems in WTS environments. WTS often
2339 need a multitude of non-PostScript drivers installed to run their clients' variety of different printer
2340 models. This often imposes the price of much increased instability.
2344 <title>Printer Drivers Running in <quote>Kernel Mode</quote> Cause Many
2348 Windows NT printer drivers, which run in <quote>kernel mode</quote>, introduce a high risk for the stability
2349 of the system if the driver is not really stable and well-tested. And there are a lot of bad drivers out
2350 there! Especially notorious is the example of the PCL printer driver that had an additional sound module
2351 running to notify users via soundcard of their finished jobs. Do I need to say that this one was also reliably
2352 causing <quote>blue screens of death</quote> on a regular basis?
2356 PostScript drivers are generally well-tested. They are not known to cause any problems, even though they also
2357 run in kernel mode. This might be because until now there have been only two different PostScript drivers: the
2358 one from Adobe and the one from Microsoft. Both are well-tested and are as stable as you can imagine on
2359 Windows. The CUPS driver is derived from the Microsoft one.
2364 <title>Workarounds Impose Heavy Limitations</title>
2367 In an attempt to work around problems, site administrators have resorted to restricting the
2368 allowed drivers installed on their WTS to one generic PCL and one PostScript driver. This, however, restricts
2369 the number of printer options available for clients to use. Often they can't get out more than simplex
2370 prints from one standard paper tray, while their devices could do much better if driven by a different driver!
2375 <title>CUPS: A <quote>Magical Stone</quote>?</title>
2378 <indexterm><primary>PPD</primary></indexterm>
2379 <indexterm><primary>PostScript</primary></indexterm>
2380 Using a PostScript driver, enabled with a CUPS-PPD, seems to be a very elegant way to overcome all these
2381 shortcomings. There are, depending on the version of Windows OS you use, up to three different PostScript
2382 drivers now available: Adobe, Microsoft, and CUPS PostScript drivers. None of them is known to cause major
2383 stability problems on WTS (even if used with many different PPDs). The clients will be able to (again) choose
2384 paper trays, duplex printing, and other settings. However, there is a certain price for this too: a CUPS
2385 server acting as a PostScript RIP for its clients requires more CPU and RAM than when just acting as a
2386 <quote>raw spooling</quote> device. Plus, this setup is not yet widely tested, although the first feedbacks
2387 look very promising.
2392 <title>PostScript Drivers with No Major Problems, Even in Kernel
2396 <indexterm><primary>DDK</primary></indexterm>
2397 <indexterm><primary>W32X86</primary></indexterm>
2398 <indexterm><primary>PostScript</primary></indexterm>
2399 <indexterm><primary>Visual Studio</primary></indexterm>
2400 <indexterm><primary>Microsoft driver</primary></indexterm>
2401 <indexterm><primary>Adobe</primary></indexterm>
2402 More recent printer drivers on W200x and XP no longer run in kernel mode (unlike Windows NT). However, both
2403 operating systems can still use the NT drivers, running in kernel mode (you can roughly tell which is which as
2404 the drivers in subdirectory <quote>2</quote> of <quote>W32X86</quote> are <quote>old</quote> ones). As was
2405 said before, the Adobe as well as the Microsoft PostScript drivers are not known to cause any stability
2406 problems. The CUPS driver is derived from the Microsoft one. There is a simple reason for this: the MS DDK
2407 (Device Development Kit) for Windows NT (which used to be available at no cost to licensees of Visual Studio)
2408 includes the source code of the Microsoft driver, and licensees of Visual Studio are allowed to use and modify
2409 it for their own driver development efforts. This is what the CUPS people have done. The license does not
2410 allow them to publish the whole of the source code. However, they have released the <quote>diff</quote> under
2411 the GPL, and if you are the owner of an <quote>MS DDK for Windows NT,</quote> you can check the driver
2418 <title>Configuring CUPS for Driver Download</title>
2421 As we have said before, all previously known methods to prepare client printer drivers on the Samba server for
2422 download and Point'n'Print convenience of Windows workstations are working with CUPS, too. These methods were
2423 described in <link linkend="classicalprinting">Classical Printing</link>. In reality, this is a pure Samba
2424 business and relates only to the Samba-Windows client relationship.
2428 <title><emphasis>cupsaddsmb</emphasis>: The Unknown Utility</title>
2432 <indexterm><primary>cupsaddsmb</primary></indexterm>
2433 The <parameter>cupsaddsmb</parameter> utility (shipped with all current CUPS versions) is an alternative
2434 method to transfer printer drivers into the Samba <smbconfsection name="[print$]"/> share. Remember, this
2435 share is where clients expect drivers deposited and set up for download and installation. It makes the sharing
2436 of any (or all) installed CUPS printers quite easy. <command>cupsaddsmb</command> can use the Adobe PostScript
2437 driver as well as the newly developed CUPS PostScript driver for Windows NT/200x/XP.
2438 <parameter>cupsaddsmb</parameter> does <emphasis>not</emphasis> work with arbitrary vendor printer drivers,
2439 but only with the <emphasis>exact</emphasis> driver files that are named in its man page.
2443 The CUPS printer driver is available from the CUPS download site. Its package name is
2444 <filename>cups-samba-[version].tar.gz</filename>. It is preferred over the Adobe drivers because it has a
2445 number of advantages:
2449 <listitem><para>It supports a much more accurate page accounting.</para></listitem>
2451 <listitem><para>It supports banner pages and page labels on all printers.</para></listitem>
2453 <listitem><para>It supports the setting of a number of job IPP attributes
2454 (such as job priority, page label, and job billing).</para></listitem>
2458 However, currently only Windows NT, 2000, and XP are supported by the
2459 CUPS drivers. You will also need to get the respective part of the Adobe driver
2460 if you need to support Windows 95, 98, and Me clients.
2465 <title>Prepare Your &smb.conf; for <command>cupsaddsmb</command></title>
2468 Prior to running <command>cupsaddsmb</command>, you need the settings in
2469 &smb.conf; as shown in <link linkend="cupsadd-ex">the &smb.conf; for cupsaddsmb Usage</link>.
2472 <example id="cupsadd-ex">
2473 <title>smb.conf for cupsaddsmb Usage</title>
2475 <smbconfsection name="[global]"/>
2476 <smbconfoption name="load printers">yes</smbconfoption>
2477 <smbconfoption name="printing">cups</smbconfoption>
2478 <smbconfoption name="printcap name">cups</smbconfoption>
2480 <smbconfsection name="[printers]"/>
2481 <smbconfoption name="comment">All Printers</smbconfoption>
2482 <smbconfoption name="path">/var/spool/samba</smbconfoption>
2483 <smbconfoption name="browseable">no</smbconfoption>
2484 <smbconfoption name="public">yes</smbconfoption>
2485 <smbconfcomment>setting depends on your requirements</smbconfcomment>
2486 <smbconfoption name="guest ok">yes</smbconfoption>
2487 <smbconfoption name="writable">no</smbconfoption>
2488 <smbconfoption name="printable">yes</smbconfoption>
2489 <smbconfoption name="printer admin">root</smbconfoption>
2490 <smbconfsection name="[print$]"/>
2491 <smbconfoption name="comment">Printer Drivers</smbconfoption>
2492 <smbconfoption name="path">/etc/samba/drivers</smbconfoption>
2493 <smbconfoption name="browseable">yes</smbconfoption>
2494 <smbconfoption name="guest ok">no</smbconfoption>
2495 <smbconfoption name="read only">yes</smbconfoption>
2496 <smbconfoption name="write list">root</smbconfoption>
2502 <title>CUPS <quote>PostScript Driver for Windows NT/200x/XP</quote></title>
2505 <indexterm><primary>PostScript</primary></indexterm>
2506 CUPS users may get the exact same package from <ulink noescape="1"
2507 url="http://www.cups.org/software.html">http://www.cups.org/software.html</ulink>. It is a separate package
2508 from the CUPS-based software files, tagged as CUPS 1.1.x Windows NT/200x/XP Printer Driver for Samba (tar.gz,
2509 192k). The filename to download is <filename>cups-samba-1.1.x.tar.gz</filename>. Upon untar and unzipping, it
2510 will reveal these files:
2512 &rootprompt;<userinput>tar xvzf cups-samba-1.1.19.tar.gz</userinput>
2521 <indexterm><primary>ESP</primary><secondary>meta packager</secondary></indexterm>
2522 <indexterm><primary>EPM</primary><see>ESP meta packager</see></indexterm>
2523 These have been packaged with the ESP meta-packager software EPM. The <filename>*.install</filename> and
2524 <filename>*.remove</filename> files are simple shell scripts, which untar the <filename>*.ss</filename> (the
2525 <filename>*.ss</filename> is nothing else but a tar archive, which can be untarred by <quote>tar</quote> too).
2526 Then it puts the content into <filename>/usr/share/cups/drivers/</filename>. This content includes three
2529 &rootprompt;<userinput>tar tv cups-samba.ss</userinput>
2536 The <parameter>cups-samba.install</parameter> shell scripts are easy to
2539 &rootprompt;<userinput>./cups-samba.install</userinput>
2541 Installing software...
2542 Updating file permissions...
2543 Running post-install commands...
2544 Installation is complete.
2548 The script should automatically put the driver files into the
2549 <filename>/usr/share/cups/drivers/</filename> directory:
2551 &rootprompt;<userinput>cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/</userinput>
2555 Due to a bug, one recent CUPS release puts the <filename>cups.hlp</filename> driver file
2556 into<filename>/usr/share/drivers/</filename> instead of <filename>/usr/share/cups/drivers/</filename>. To work
2557 around this, copy/move the file (after running the <command>./cups-samba.install</command> script) manually to
2562 <indexterm><primary>DDK</primary></indexterm>
2563 This new CUPS PostScript driver is currently binary only, but free of charge. No complete source code is
2564 provided (yet). The reason is that it has been developed with the help of the Microsoft DDK and compiled with
2565 Microsoft Visual Studio 6. Driver developers are not allowed to distribute the whole of the source code as
2566 free software. However, CUPS developers released the <quote>diff</quote> in source code under the GPL, so
2567 anybody with a license for Visual Studio and a DDK will be able to compile for himself or herself.
2572 <title>Recognizing Different Driver Files</title>
2575 The CUPS drivers do not support the older Windows 95/98/Me, but only the Windows NT/2000/XP client.
2578 <para>Windows NT, 2000, and XP are supported by:</para>
2581 <listitem><para>cups.hlp</para></listitem>
2582 <listitem><para>cupsdrvr.dll</para></listitem>
2583 <listitem><para>cupsui.dll</para></listitem>
2587 Adobe drivers are available for the older Windows 95/98/Me as well as
2588 for Windows NT/2000/XP clients. The set of files is different from the
2589 different platforms.
2592 <para>Windows 95, 98, and ME are supported by:</para>
2595 <listitem><para>ADFONTS.MFM</para></listitem>
2596 <listitem><para>ADOBEPS4.DRV</para></listitem>
2597 <listitem><para>ADOBEPS4.HLP</para></listitem>
2598 <listitem><para>DEFPRTR2.PPD</para></listitem>
2599 <listitem><para>ICONLIB.DLL</para></listitem>
2600 <listitem><para>PSMON.DLL</para></listitem>
2603 <para>Windows NT, 2000, and XP are supported by:</para>
2606 <listitem><para>ADOBEPS5.DLL</para></listitem>
2607 <listitem><para>ADOBEPSU.DLL</para></listitem>
2608 <listitem><para>ADOBEPSU.HLP</para></listitem>
2612 <indexterm><primary>Adobe driver files</primary></indexterm>
2613 If both the Adobe driver files and the CUPS driver files for the support of Windows NT/200x/XP are presently
2614 installed on the server, the Adobe files will be ignored and the CUPS files will be used. If you prefer
2615 &smbmdash; for whatever reason &smbmdash; to use Adobe-only drivers, move away the three CUPS driver files.
2616 The Windows 9x/Me clients use the Adobe drivers in any case.
2621 <title>Acquiring the Adobe Driver Files</title>
2624 Acquiring the Adobe driver files seems to be unexpectedly difficult for many users. They are not available on
2625 the Adobe Web site as single files, and the self-extracting and/or self-installing Windows-.exe is not easy to
2626 locate either. You probably need to use the included native installer and run the installation process on one
2627 client once. This will install the drivers (and one generic PostScript printer) locally on the client. When
2628 they are installed, share the generic PostScript printer. After this, the client's <smbconfsection
2629 name="[print$]"/> share holds the Adobe files, which you can get with smbclient from the CUPS host.
2634 <title>ESP Print Pro PostScript Driver for Windows NT/200x/XP</title>
2637 <indexterm><primary>ESP</primary><secondary>Print Pro</secondary></indexterm>
2638 Users of the ESP Print Pro software are able to install the ESP print drivers package as an alternative to the
2639 Adobe PostScript drivers. To do so, retrieve the driver files from the normal download area of the ESP Print
2640 Pro software at <ulink noescape="1" url="http://www.easysw.com/software.html">Easy Software</ulink> web site.
2641 You need to locate the link labeled <quote>SAMBA</quote> among the <guilabel>Download Printer Drivers for ESP
2642 Print Pro 4.x</guilabel> area and download the package. Once installed, you can prepare any driver by simply
2643 highlighting the printer in the Printer Manager GUI and selecting <guilabel>Export Driver...</guilabel> from
2644 the menu. Of course, you need to have prepared Samba beforehand to handle the driver files; that is, set up
2645 the <smbconfsection name="[print$]"/> share, and so on. The ESP Print Pro package includes the CUPS driver
2646 files as well as a (licensed) set of Adobe drivers for the Windows 95/98/Me client family.
2651 <title>Caveats to Be Considered</title>
2655 <indexterm><primary>cupsaddsmb</primary></indexterm>
2656 <indexterm><primary>cups.hlp</primary></indexterm>
2657 <indexterm><primary>WIN40</primary></indexterm>
2658 <indexterm><primary>W32X86</primary></indexterm>
2659 Once you have run the install script (and possibly manually moved the <filename>cups.hlp</filename> file to
2660 <filename>/usr/share/cups/drivers/</filename>), the driver is ready to be put into Samba's <smbconfsection
2661 name="[print$]"/> share (which often maps to <filename>/etc/samba/drivers/</filename> and contains a
2662 subdirectory tree with <emphasis>WIN40</emphasis> and <emphasis>W32X86</emphasis> branches). You do this by
2663 running <command>cupsaddsmb</command> (see also <command>man cupsaddsmb</command> for CUPS since release
2668 <indexterm><primary>Single Sign-On</primary></indexterm>
2669 <indexterm><primary>Domain Controller</primary></indexterm>
2670 You may need to put root into the smbpasswd file by running <command>smbpasswd</command>; this is especially
2671 important if you should run this whole procedure for the first time and are not working in an environment
2672 where everything is configured for <emphasis>single sign-on</emphasis> to a Windows Domain Controller.
2676 Once the driver files are in the <smbconfsection name="[print$]"/> share and are initialized, they are ready
2677 to be downloaded and installed by the Windows NT/200x/XP clients.
2681 Win 9x/Me clients will not work with the CUPS PostScript driver. For these you still need to use the
2682 <filename>ADOBE*.*</filename> drivers, as previously stated.
2687 It is not harmful if you still have the <filename>ADOBE*.*</filename> driver files from previous installations
2688 in the <filename>/usr/share/cups/drivers/</filename> directory. The new <command>cupsaddsmb</command> (from
2689 1.1.16) will automatically prefer its own drivers if it finds both.
2693 <indexterm><primary>"Printers" folder</primary></indexterm>
2694 <indexterm><primary>Adobe PostScript</primary></indexterm>
2695 Should your Windows clients have had the old <filename>ADOBE*.*</filename> files for the Adobe PostScript
2696 driver installed, the download and installation of the new CUPS PostScript driver for Windows NT/200x/XP will
2697 fail at first. You need to wipe the old driver from the clients first. It is not enough to
2698 <quote>delete</quote> the printer, because the driver files will still be kept by the clients and re-used if
2699 you try to re-install the printer. To really get rid of the Adobe driver files on the clients, open the
2700 <guilabel>Printers</guilabel> folder (possibly via <guilabel>Start -> Settings -> Control Panel ->
2701 Printers</guilabel>), right-click on the folder background, and select <guimenuitem>Server
2702 Properties</guimenuitem>. When the new dialog opens, select the <guilabel>Drivers</guilabel> tab. On the list
2703 select the driver you want to delete and click the <guilabel>Delete</guilabel> button. This will only work if
2704 there is not one single printer left that uses that particular driver. You need to <quote>delete</quote> all
2705 printers using this driver in the <guilabel>Printers</guilabel> folder first. You will need Administrator
2706 privileges to do this.
2710 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
2711 <indexterm><primary>CUPS PostScript</primary></indexterm>
2712 Once you have successfully downloaded the CUPS PostScript driver to a client, you can easily switch all
2713 printers to this one by proceeding as described in <link linkend="classicalprinting">Classical Printing
2714 Support</link>. Either change a driver for an existing printer by running the <guilabel>Printer
2715 Properties</guilabel> dialog, or use <command>rpcclient</command> with the <command>setdriver</command>
2721 <title>Windows CUPS PostScript Driver Versus Adobe Driver</title>
2724 Are you interested in a comparison between the CUPS and the Adobe PostScript drivers? For our purposes, these
2725 are the most important items that weigh in favor of CUPS:
2729 <listitem><para>No hassle with the Adobe EULA.</para></listitem>
2731 <listitem><para>No hassle with the question, <quote>Where do I
2732 get the ADOBE*.* driver files?</quote></para></listitem>
2735 <indexterm><primary>PJL</primary></indexterm>
2736 The Adobe drivers (on request of the printer PPD associated with them) often put a PJL header in front of the
2737 main PostScript part of the print file. Thus, the print file starts with <parameter><1B
2738 >%-12345X</parameter> or <parameter><escape>%-12345X</parameter> instead of
2739 <parameter>%!PS</parameter>. This leads to the CUPS daemon autotyping the incoming file as a print-ready file,
2740 not initiating a pass through the <parameter>pstops</parameter> filter (to speak more technically, it is not
2741 regarded as the generic MIME-type <indexterm><primary>application/postscript</primary></indexterm>
2742 <parameter>application/postscript</parameter>, but as the more special MIME type
2743 <indexterm><primary>application/cups.vnd-postscript</primary></indexterm>
2744 <parameter>application/cups.vnd-postscript</parameter>), which therefore also leads to the page accounting in
2745 <parameter>/var/log/cups/page_log</parameter> not receiving the exact number of pages; instead the dummy page
2746 number of <quote>1</quote> is logged in a standard setup).
2749 <listitem><para>The Adobe driver has more options to misconfigure the
2750 <indexterm><primary>Adobe driver</primary></indexterm>
2751 PostScript generated by it (like setting it inadvertently to
2752 <guilabel>Optimize for Speed</guilabel> instead of
2753 <guilabel>Optimize for Portability</guilabel>, which
2754 could lead to CUPS being unable to process it).</para></listitem>
2756 <listitem><para>The CUPS PostScript driver output sent by Windows
2757 <indexterm><primary>CUPS PostScript driver</primary></indexterm>
2758 clients to the CUPS server is guaranteed to autotype
2759 as the generic MIME type <parameter>application/postscript</parameter>,
2760 thus passing through the CUPS <parameter>pstops</parameter> filter and logging the
2761 correct number of pages in the <filename>page_log</filename> for
2762 accounting and quota purposes.</para></listitem>
2765 <indexterm><primary>banner pages</primary></indexterm>
2766 The CUPS PostScript driver supports the sending of additional standard (IPP) print options by Windows
2767 NT/200x/XP clients. Such additional print options are naming the CUPS standard <emphasis>banner
2768 pages</emphasis> (or the custom ones, should they be installed at the time of driver download), using the CUPS
2769 page-label option, setting a job priority, and setting the scheduled time of printing (with the option to
2770 support additional useful IPP job attributes in the future).
2773 <listitem><para>The CUPS PostScript driver supports the inclusion of
2774 the new <parameter>*cupsJobTicket</parameter> comments at the
2775 beginning of the PostScript file (which could be used in the future
2776 for all sorts of beneficial extensions on the CUPS side, but which will
2777 not disturb any other applications because they will regard it as a comment
2778 and simply ignore it).</para></listitem>
2780 <listitem><para>The CUPS PostScript driver will be the heart of the
2781 fully fledged CUPS IPP client for Windows NT/200x/XP to be released soon
2782 (probably alongside the first beta release for CUPS 1.2).</para></listitem>
2788 <title>Run cupsaddsmb (Quiet Mode)</title>
2792 <indexterm><primary>cupsaddsmb</primary></indexterm>
2793 <indexterm><primary>point 'n' print</primary></indexterm>
2794 The <command>cupsaddsmb</command> command copies the needed files into your <smbconfsection name="[print$]"/>
2795 share. Additionally, the PPD associated with this printer is copied from <filename>/etc/cups/ppd/</filename>
2796 to <smbconfsection name="[print$]"/>. There the files wait for convenient Windows client installations via
2797 Point'n'Print. Before we can run the command successfully, we need to be sure that we can authenticate toward
2798 Samba. If you have a small network, you are probably using user-level security (<smbconfoption
2799 name="security">user</smbconfoption>).
2803 Here is an example of a successfully run <command>cupsaddsmb</command> command:
2804 <indexterm><primary>banner pages</primary></indexterm>
2805 <indexterm><primary>cupsaddsmb</primary></indexterm>
2807 &rootprompt;<userinput>cupsaddsmb -U root infotec_IS2027</userinput>
2808 Password for root required to access localhost via Samba: <userinput>['secret']</userinput>
2812 <indexterm><primary>cupsaddsmb</primary></indexterm>
2813 To share <emphasis>all</emphasis> printers and drivers, use the
2814 <option>-a</option> parameter instead of a printer name. Since
2815 <command>cupsaddsmb</command> <quote>exports</quote> the printer drivers to Samba, it should be
2816 obvious that it only works for queues with a CUPS driver associated.
2821 <title>Run cupsaddsmb with Verbose Output</title>
2825 <indexterm><primary>cupsaddsmb</primary></indexterm>
2826 Probably you want to see what's going on. Use the
2827 <option>-v</option> parameter to get a more verbose output. The
2828 output below was edited for better readability: all <quote>\</quote> at the end of
2829 a line indicate that I inserted an artificial line break plus some
2831 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
2832 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
2834 &rootprompt;<userinput>cupsaddsmb -U root -v infotec_2105</userinput>
2835 Password for root required to access localhost via &example.server.samba;:
2836 Running command: smbclient //localhost/print\$ -N -U'root%secret' \
2838 put /var/spool/cups/tmp/3e98bf2d333b5 W32X86/infotec_2105.ppd; \
2839 put /usr/share/cups/drivers/cupsdrvr.dll W32X86/cupsdrvr.dll; \
2840 put /usr/share/cups/drivers/cupsui.dll W32X86/cupsui.dll; \
2841 put /usr/share/cups/drivers/cups.hlp W32X86/cups.hlp'
2842 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
2843 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
2844 NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86
2845 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \W32X86/infotec_2105.ppd
2846 putting file /usr/share/cups/drivers/cupsdrvr.dll as \W32X86/cupsdrvr.dll
2847 putting file /usr/share/cups/drivers/cupsui.dll as \W32X86/cupsui.dll
2848 putting file /usr/share/cups/drivers/cups.hlp as \W32X86/cups.hlp
2850 Running command: rpcclient localhost -N -U'root%secret'
2851 -c 'adddriver "Windows NT x86" \
2852 "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \
2854 cmd = adddriver "Windows NT x86" \
2855 "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \
2857 Printer Driver infotec_2105 successfully installed.
2859 Running command: smbclient //localhost/print\$ -N -U'root%secret' \
2861 put /var/spool/cups/tmp/3e98bf2d333b5 WIN40/infotec_2105.PPD; \
2862 put /usr/share/cups/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM; \
2863 put /usr/share/cups/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV; \
2864 put /usr/share/cups/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP; \
2865 put /usr/share/cups/drivers/DEFPRTR2.PPD WIN40/DEFPRTR2.PPD; \
2866 put /usr/share/cups/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL; \
2867 put /usr/share/cups/drivers/PSMON.DLL WIN40/PSMON.DLL;'
2868 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
2869 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
2870 NT_STATUS_OBJECT_NAME_COLLISION making remote directory \WIN40
2871 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \WIN40/infotec_2105.PPD
2872 putting file /usr/share/cups/drivers/ADFONTS.MFM as \WIN40/ADFONTS.MFM
2873 putting file /usr/share/cups/drivers/ADOBEPS4.DRV as \WIN40/ADOBEPS4.DRV
2874 putting file /usr/share/cups/drivers/ADOBEPS4.HLP as \WIN40/ADOBEPS4.HLP
2875 putting file /usr/share/cups/drivers/DEFPRTR2.PPD as \WIN40/DEFPRTR2.PPD
2876 putting file /usr/share/cups/drivers/ICONLIB.DLL as \WIN40/ICONLIB.DLL
2877 putting file /usr/share/cups/drivers/PSMON.DLL as \WIN40/PSMON.DLL
2879 Running command: rpcclient localhost -N -U'root%secret' \
2880 -c 'adddriver "Windows 4.0" \
2881 "infotec_2105:ADOBEPS4.DRV:infotec_2105.PPD:NULL:ADOBEPS4.HLP: \
2882 PSMON.DLL:RAW:ADOBEPS4.DRV,infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL, \
2883 ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"'
2884 cmd = adddriver "Windows 4.0" "infotec_2105:ADOBEPS4.DRV:\
2885 infotec_2105.PPD:NULL:ADOBEPS4.HLP:PSMON.DLL:RAW:ADOBEPS4.DRV,\
2886 infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL,ADFONTS.MFM,DEFPRTR2.PPD,\
2888 Printer Driver infotec_2105 successfully installed.
2890 Running command: rpcclient localhost -N -U'root%secret' \
2891 -c 'setdriver infotec_2105 infotec_2105'
2892 cmd = setdriver infotec_2105 infotec_2105
2893 Successfully set infotec_2105 to driver infotec_2105.
2897 You will see the root password for the Samba account printed on screen.
2901 If you look closely, you'll discover your root password was transferred unencrypted over the wire, so beware!
2902 Also, if you look further, you may discover error messages like NT_STATUS_OBJECT_NAME_COLLISION in the output.
2903 This will occur when the directories WIN40 and W32X86 already existed in the <smbconfsection name="[print$]"/>
2904 driver download share (from a previous driver installation). These are harmless warning messages.
2909 <title>Understanding cupsaddsmb</title>
2912 <indexterm><primary>cupsaddsmb</primary></indexterm>
2913 What has happened? What did <command>cupsaddsmb</command> do? There are five stages of the procedure:
2918 <indexterm><primary>IPP</primary></indexterm>
2919 Call the CUPS server via IPP and request the driver files and the PPD file for the named printer.</para></listitem>
2921 <listitem><para>Store the files temporarily in the local TEMPDIR (as defined in <filename>cupsd.conf</filename>).</para></listitem>
2923 <listitem><para>Connect via smbclient to the Samba server's <smbconfsection name="[print$]"/> share and put the files into the
2924 share's WIN40 (for Windows 9x/Me) and W32X86 (for Windows NT/200x/XP) subdirectories.</para></listitem>
2927 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
2928 Connect via rpcclient to the Samba server and execute the <command>adddriver</command> command with the correct parameters.
2932 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
2933 Connect via rpcclient to the Samba server a second time and execute the <command>setdriver</command> command.</para></listitem>
2938 You can run the <command>cupsaddsmb</command> utility with parameters to specify one remote host as Samba host
2939 and a second remote host as CUPS host. Especially if you want to get a deeper understanding, it is a good idea
2940 to try it and see more clearly what is going on (though in real life most people will have their CUPS and
2941 Samba servers run on the same host):
2943 &rootprompt;<userinput>cupsaddsmb -H sambaserver -h cupsserver -v printer</userinput>
2950 <title>How to Recognize If cupsaddsmb Completed Successfully</title>
2953 You <emphasis>must</emphasis> always check if the utility completed
2954 successfully in all fields. You need at minimum these three messages
2959 <listitem><para><emphasis>Printer Driver infotec_2105 successfully
2960 installed.</emphasis> # (for the W32X86 == Windows NT/200x/XP
2961 architecture).</para></listitem>
2963 <listitem><para><emphasis>Printer Driver infotec_2105 successfully
2964 installed.</emphasis> # (for the WIN40 == Windows 9x/Me
2965 architecture).</para></listitem>
2967 <listitem><para><emphasis>Successfully set [printerXPZ] to driver
2968 [printerXYZ].</emphasis></para></listitem>
2972 These messages are probably not easily recognized in the general
2973 output. If you run <command>cupsaddsmb</command> with the <option>-a</option>
2974 parameter (which tries to prepare <emphasis>all</emphasis> active CUPS
2975 printer drivers for download), you might miss if individual printer
2976 drivers had problems installing properly. A redirection of the
2977 output will help you analyze the results in retrospective.
2983 SetPrinter call failed!
2984 result was WERR_ACCESS_DENIED
2986 it means that you might have set <smbconfoption name="use client driver">yes</smbconfoption> for this printer.
2987 Setting it to <quote>no</quote> will solve the problem. Refer to the &smb.conf; man page for explanation of
2988 the <parameter>use client driver</parameter>.
2992 It is impossible to see any diagnostic output if you do not run <command>cupsaddsmb</command> in verbose mode.
2993 Therefore, we strongly recommend against use of the default quiet mode. It will hide any problems from you that
2999 <title>cupsaddsmb with a Samba PDC</title>
3002 <indexterm><primary>cupsaddsmb</primary></indexterm>
3003 <indexterm><primary>PDC</primary></indexterm>
3004 Can't get the standard <command>cupsaddsmb</command> command to run on a Samba PDC? Are you asked for the
3005 password credential again and again, and the command just will not take off at all? Try one of these
3010 &rootprompt;<userinput>cupsaddsmb -U &example.workgroup;\\root -v printername</userinput>
3011 &rootprompt;<userinput>cupsaddsmb -H &example.pdc.samba; -U &example.workgroup;\\root -v printername</userinput>
3012 &rootprompt;<userinput>cupsaddsmb -H &example.pdc.samba; -U &example.workgroup;\\root -h cups-server -v printername</userinput>
3016 (Note the two backslashes: the first one is required to <quote>escape</quote> the second one).
3021 <title>cupsaddsmb Flowchart</title>
3024 <indexterm><primary>cupsaddsmb</primary></indexterm>
3025 <indexterm><primary>raw print</primary></indexterm>
3026 <link linkend="small14">The cupsaddsmb Flowchart</link> shows a chart about the procedures, command flows, and
3027 data flows of the <command>cupaddsmb</command> command. Note again: cupsaddsmb is
3028 not intended to, and does not work with, raw print queues!
3031 <figure id="small14">
3032 <title>cupsaddsmb Flowchart.</title>
3033 <imagefile>14small</imagefile></figure>
3037 <title>Installing the PostScript Driver on a Client</title>
3040 <indexterm><primary>point'n'print</primary></indexterm>
3041 <indexterm><primary>cupsaddsmb</primary></indexterm>
3042 After <command>cupsaddsmb</command> is completed, your driver is prepared for the clients to use. Here are the
3043 steps you must perform to download and install it via Point'n'Print. From a Windows client, browse to the
3050 <indexterm><primary>"Printers" folder</primary></indexterm>
3051 Open the <guilabel>Printers</guilabel> share of Samba in Network Neighborhood.</para></listitem>
3053 <listitem><para>Right-click on the printer in question.</para></listitem>
3055 <listitem><para>From the opening context menu select
3056 <guimenuitem>Install...</guimenuitem> or
3057 <guimenuitem>Connect...</guimenuitem> (depending on the Windows version you use).</para></listitem>
3061 After a few seconds, there should be a new printer in your client's <emphasis>local</emphasis>
3062 <guilabel>Printers</guilabel> folder. On Windows XP it will follow a naming convention of
3063 <emphasis>PrinterName on SambaServer</emphasis>. (In my current case it is infotec_2105 on kde-bitshop). If
3064 you want to test it and send your first job from an application like Winword, the new printer appears in a
3065 <filename>\\SambaServer\PrinterName</filename> entry in the drop-down list of available printers.
3069 <indexterm><primary>PPD</primary></indexterm>
3070 <indexterm><primary>Adobe PostScript driver</primary></indexterm>
3071 <indexterm><primary>net use lpt1:</primary></indexterm>
3072 <command>cupsaddsmb</command> will only reliably work with CUPS version 1.1.15 or higher and with Samba
3073 version 2.2.4, or later. If it does not work, or if the automatic printer driver download to the clients does
3074 not succeed, you can still manually install the CUPS printer PPD on top of the Adobe PostScript driver on
3075 clients. Then point the client's printer queue to the Samba printer share for a UNC type of connection:
3077 &dosprompt;<userinput>net use lpt1: \\sambaserver\printershare /user:ntadmin</userinput>
3079 should you desire to use the CUPS networked PostScript RIP functions. (Note that user <quote>ntadmin</quote>
3080 needs to be a valid Samba user with the required privileges to access the printershare.) This sets up the
3081 printer connection in the traditional LanMan way (not using MS-RPC).
3085 <sect2 id="cups-avoidps1">
3086 <title>Avoiding Critical PostScript Driver Settings on the Client</title>
3089 Printing works, but there are still problems. Most jobs print well, some do not print at all. Some jobs have
3090 problems with fonts, which do not look very good. Some jobs print fast and some are dead-slow. Many of these
3091 problems can be greatly reduced or even completely eliminated if you follow a few guidelines. Remember, if
3092 your print device is not PostScript-enabled, you are treating your Ghostscript installation on your CUPS host
3093 with the output your client driver settings produce. Treat it well:
3098 Avoid the PostScript Output Option: Optimize for Speed setting. Use the Optimize for Portability instead
3099 (Adobe PostScript driver).</para></listitem>
3102 Don't use the Page Independence: NO setting. Instead, use Page Independence: YES (CUPS PostScript Driver).
3106 Recommended is the True Type Font Downloading Option: Native True Type over Automatic and Outline;
3107 you should by all means avoid Bitmap (Adobe PostScript Driver).</para></listitem>
3110 Choose True Type Font: Download as Softfont into Printer over the default Replace by Device
3111 Font (for exotic fonts, you may need to change it back to get a printout at all; Adobe).</para></listitem>
3114 Sometimes you can choose PostScript Language Level: in case of problems try 2
3115 instead of 3 (the latest ESP Ghostscript package handles Level 3 PostScript very well; Adobe).
3119 Say Yes to PostScript Error Handler (Adobe).</para></listitem>
3126 <title>Installing PostScript Driver Files Manually Using rpcclient</title>
3129 Of course, you can run all the commands that are embedded into the
3130 cupsaddsmb convenience utility yourself, one by one, and upload
3131 and prepare the driver files for future client downloads.
3135 <listitem><para>Prepare Samba (a CUPS print queue with the name of the
3136 printer should be there. We are providing the driver now).</para></listitem>
3138 <listitem><para>Copy all files to <smbconfsection name="[print$]"/>.</para></listitem>
3141 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3142 Run <command>rpcclient adddriver</command>
3143 (for each client architecture you want to support).</para></listitem>
3146 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3147 Run <command>rpcclient setdriver.</command></para></listitem>
3151 <indexterm><primary>rpcclient</primary><secondary>enumports</secondary></indexterm>
3152 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3153 <indexterm><primary>rpcclient</primary><secondary>enumdrivers</secondary></indexterm>
3154 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3155 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3156 We are going to do this now. First, read the man page on <parameter>rpcclient</parameter> to get a first idea.
3157 Look at all the printing-related subcommands: <command>enumprinters</command>, <command>enumdrivers</command>,
3158 <command>enumports</command>, <command>adddriver</command>, and <command>setdriver</command> are among the
3159 most interesting ones. <parameter>rpcclient</parameter> implements an important part of the MS-RPC protocol.
3160 You can use it to query (and command) a Windows NT (or 200x/XP) PC, too. MS-RPC is used by Windows clients,
3161 among other things, to benefit from the Point'n'Print features. Samba can now mimic this as well.
3165 <title>A Check of the rpcclient man Page</title>
3168 First let's check the <parameter>rpcclient</parameter> man page. Here are two relevant passages:
3172 <indexterm><primary>adddriver</primary></indexterm>
3173 <indexterm><primary>AddPrinterDriver()</primary></indexterm>
3174 <indexterm><primary>getdriverdir</primary></indexterm>
3175 <command>adddriver <arch> <config></command> Execute an <command>AddPrinterDriver()</command> RPC
3176 to install the printer driver information on the server. The driver files should already exist in the
3177 directory returned by <command>getdriverdir</command>. Possible values for <parameter>arch</parameter> are the
3178 same as those for the <command>getdriverdir</command> command. The <parameter>config</parameter> parameter is
3186 Language Monitor Name:\
3188 Comma Separated list of Files
3192 Any empty fields should be entered as the string <quote>NULL</quote>.
3196 Samba does not need to support the concept of print monitors, since these only apply to local printers whose
3197 drivers can use a bidirectional link for communication. This field should be <quote>NULL</quote>. On a remote
3198 NT print server, the print monitor for a driver must already be installed before adding the driver or else the
3203 <indexterm><primary>setdriver</primary></indexterm>
3204 <indexterm><primary>SetPrinter()</primary></indexterm>
3205 <command>setdriver <printername> <drivername></command> Execute a <command>SetPrinter()</command>
3206 command to update the printer driver associated with an installed printer. The printer driver must already be
3207 correctly installed on the print server.
3211 <indexterm><primary>enumprinters</primary></indexterm>
3212 <indexterm><primary>enumdrivers</primary></indexterm>
3213 See also the <command>enumprinters</command> and <command>enumdrivers</command> commands to
3214 obtain a list of installed printers and drivers.
3220 <title>Understanding the rpcclient man Page</title>
3223 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3224 The <emphasis>exact</emphasis> format isn't made too clear by the man page, since you have to deal with some
3225 parameters containing spaces. Here is a better description for it. We have line-broken the command and
3226 indicated the breaks with <quote>\</quote>. Usually you would type the command in one line without the line
3229 adddriver "Architecture" \
3230 "LongPrinterName:DriverFile:DataFile:ConfigFile:HelpFile:\
3231 LanguageMonitorFile:DataType:ListOfFiles,Comma-separated"
3235 What the man pages denote as a simple <parameter><config></parameter> keyword in reality consists of
3236 eight colon-separated fields. The last field may take multiple (in some very insane cases, even 20 different
3237 additional) files. This might sound confusing at first. What the man pages call the
3238 <quote>LongPrinterName</quote> in reality should be called the <quote>Driver Name</quote>. You can name it
3239 anything you want, as long as you use this name later in the <command>rpcclient ... setdriver</command>
3240 command. For practical reasons, many name the driver the same as the printer.
3244 It isn't simple at all. I hear you asking: <quote>How do I know which files are Driver File</quote>,
3245 <quote>Data File</quote>, <quote>Config File</quote>, <quote>Help File</quote> and <quote>Language Monitor
3246 File in each case?</quote> For an answer, you may want to have a look at how a Windows NT box with a shared
3247 printer presents the files to us. Remember that this whole procedure has to be developed by the Samba Team by
3248 listening to the traffic caused by Windows computers on the wire. We may as well turn to a Windows box now and
3249 access it from a UNIX workstation. We will query it with <command>rpcclient</command> to see what it tells us
3250 and try to understand the man page more clearly.
3255 <title>Producing an Example by Querying a Windows Box</title>
3258 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3259 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3260 We could run <command>rpcclient</command> with a <command>getdriver</command> or a
3261 <command>getprinter</command> subcommand (in level 3 verbosity) against it. Just sit down at a UNIX or Linux
3262 workstation with the Samba utilities installed, then type the following command:
3264 &rootprompt;<userinput>rpcclient -U'user%secret' NT-SERVER -c 'getdriver printername 3'</userinput>
3268 From the result it should become clear which is which. Here is an example from my installation:
3269 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3271 &rootprompt;<userinput>rpcclient -U'Danka%xxxx' W200xSERVER \
3272 -c'getdriver "DANKA InfoStream Virtual Printer" 3'</userinput>
3273 cmd = getdriver "DANKA InfoStream Virtual Printer" 3
3276 Printer Driver Info 3:
3278 Driver Name: [DANKA InfoStream]
3279 Architecture: [Windows NT x86]
3280 Driver Path: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRIPT.DLL]
3281 Datafile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\INFOSTRM.PPD]
3282 Configfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRPTUI.DLL]
3283 Helpfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRIPT.HLP]
3298 Some printer drivers list additional files under the label <parameter>Dependentfiles</parameter>, and these
3299 would go into the last field <parameter>ListOfFiles,Comma-separated</parameter>. For the CUPS PostScript
3300 drivers, we do not need any (nor would we for the Adobe PostScript driver); therefore, the field will get a
3301 <quote>NULL</quote> entry.
3306 <title>Requirements for adddriver and setdriver to Succeed</title>
3309 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3310 <indexterm><primary>cupsaddsmb</primary></indexterm>
3311 <indexterm><primary>setdriver</primary></indexterm>
3312 From the man page (and from the quoted output of <command>cupsaddsmb</command> above) it becomes clear that
3313 you need to have certain conditions in order to make the manual uploading and initializing of the driver files
3314 succeed. The two <command>rpcclient</command> subcommands (<command>adddriver</command> and
3315 <command>setdriver</command>) need to encounter the following preconditions to complete successfully:
3319 <listitem><para>You are connected as <smbconfoption name="printer admin"/> or root (this is
3320 <emphasis>not</emphasis> the <quote>Printer Operators</quote> group in NT, but the <emphasis>printer
3321 admin</emphasis> group as defined in the <smbconfsection name="[global]"/> section of &smb.conf;).
3324 <listitem><para>Copy all required driver files to <filename>\\SAMBA\print$\w32x86</filename> and
3325 <filename>\\SAMBA\print$\win40</filename> as appropriate. They will end up in the <quote>0</quote> respective
3326 <quote>2</quote> subdirectories later. For now, <emphasis>do not</emphasis> put them there; they'll be
3327 automatically used by the <command>adddriver</command> subcommand. (If you use <command>smbclient</command> to
3328 put the driver files into the share, note that you need to escape the <quote>$</quote>: <command>smbclient
3329 //sambaserver/print\$ -U root.</command>)</para></listitem>
3331 <listitem><para>The user you're connecting as must be able to write to
3332 the <smbconfsection name="[print$]"/> share and create
3333 subdirectories.</para></listitem>
3335 <listitem><para>The printer you are going to set up for the Windows
3336 clients needs to be installed in CUPS already.</para></listitem>
3339 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3340 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3341 The CUPS printer must be known to Samba; otherwise the <command>setdriver</command> subcommand fails with an
3342 NT_STATUS_UNSUCCESSFUL error. To check if the printer is known by Samba, you may use the
3343 <command>enumprinters</command> subcommand to <command>rpcclient</command>. A long-standing bug prevented a
3344 proper update of the printer list until every smbd process had received a SIGHUP or was restarted. Remember
3345 this in case you've created the CUPS printer just recently and encounter problems: try restarting Samba.
3351 <title>Manual Driver Installation in 15 Steps</title>
3354 We are going to install a printer driver now by manually executing all
3355 required commands. Because this may seem a rather complicated process at
3356 first, we go through the procedure step by step, explaining every
3357 single action item as it comes up.
3361 <title>Manual Driver Installation</title>
3364 <title>Install the printer on CUPS.</title>
3367 &rootprompt;<userinput>lpadmin -p mysmbtstprn -v socket://10.160.51.131:9100 -E \
3368 -P canonIR85.ppd</userinput>
3372 This installs a printer with the name <parameter>mysmbtstprn</parameter>
3373 to the CUPS system. The printer is accessed via a socket
3374 (a.k.a. JetDirect or Direct TCP/IP) connection. You need to be root
3380 <title>(Optional.) Check if the printer is recognized by Samba.</title>
3383 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3385 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'enumprinters' localhost \
3386 | grep -C2 mysmbtstprn</userinput>
3388 name:[\\kde-bitshop\mysmbtstprn]
3389 description:[\\kde-bitshop\mysmbtstprn,,mysmbtstprn]
3390 comment:[mysmbtstprn]
3395 This should show the printer in the list. If not, stop and restart the Samba daemon (smbd) or send a HUP signal:
3397 &rootprompt;<userinput>kill -HUP `pidof smbd`</userinput>
3399 Check again. Troubleshoot and repeat until successful. Note the <quote>empty</quote> field between the two
3400 commas in the <quote>description</quote> line. The driver name would appear here if there was one already. You
3401 need to know root's Samba password (as set by the <command>smbpasswd</command> command) for this step and most
3402 of the following steps. Alternatively, you can authenticate as one of the users from the <quote>write
3403 list</quote> as defined in &smb.conf; for <smbconfsection name="[print$]"/>.
3408 <title>(Optional.) Check if Samba knows a driver for the printer.</title>
3411 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3412 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3414 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2'\
3415 localhost | grep driver </userinput>
3419 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' \
3420 localhost | grep -C4 driv</userinput>
3422 servername:[\\kde-bitshop]
3423 printername:[\\kde-bitshop\mysmbtstprn]
3424 sharename:[mysmbtstprn]
3425 portname:[Samba Printer Port]
3427 comment:[mysmbtstprn]
3430 printprocessor:[winprint]
3432 &rootprompt;<userinput>rpcclient -U root%xxxx -c 'getdriver mysmbtstprn' localhost</userinput>
3433 result was WERR_UNKNOWN_PRINTER_DRIVER
3437 None of the three commands shown above should show a driver.
3438 This step was done for the purpose of demonstrating this condition. An
3439 attempt to connect to the printer at this stage will prompt a
3440 message along the lines of, <quote>The server does not have the required printer
3441 driver installed.</quote>
3446 <title>Put all required driver files into Samba's
3450 &rootprompt;<userinput>smbclient //localhost/print\$ -U 'root%xxxx' \
3452 put /etc/cups/ppd/mysmbtstprn.ppd mysmbtstprn.PPD; \
3453 put /usr/share/cups/drivers/cupsui.dll cupsui.dll; \
3454 put /usr/share/cups/drivers/cupsdrvr.dll cupsdrvr.dll; \
3455 put /usr/share/cups/drivers/cups.hlp cups.hlp'</userinput>
3459 (This command should be entered in one long single line. Line breaks and the line ends indicated by
3460 <quote>\</quote> have been inserted for readability reasons.) This step is <emphasis>required</emphasis> for
3461 the next one to succeed. It makes the driver files physically present in the <smbconfsection name="[print$]"/>
3462 share. However, clients would still not be able to install them, because Samba does not yet treat them as
3463 driver files. A client asking for the driver would still be presented with a <quote>not installed here</quote>
3469 <title>Verify where the driver files are now.</title>
3472 &rootprompt;<userinput>ls -l /etc/samba/drivers/W32X86/</userinput>
3474 drwxr-sr-x 2 root ntadmin 532 May 25 23:08 2
3475 drwxr-sr-x 2 root ntadmin 670 May 16 03:15 3
3476 -rwxr--r-- 1 root ntadmin 14234 May 25 23:21 cups.hlp
3477 -rwxr--r-- 1 root ntadmin 278380 May 25 23:21 cupsdrvr.dll
3478 -rwxr--r-- 1 root ntadmin 215848 May 25 23:21 cupsui.dll
3479 -rwxr--r-- 1 root ntadmin 169458 May 25 23:21 mysmbtstprn.PPD
3483 The driver files now are in the W32X86 architecture <quote>root</quote> of
3484 <smbconfsection name="[print$]"/>.
3489 <title>Tell Samba that these are driver files (<command>adddriver</command>).</title>
3492 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3494 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" \
3495 "mydrivername:cupsdrvr.dll:mysmbtstprn.PPD: \
3496 cupsui.dll:cups.hlp:NULL:RAW:NULL"' \
3497 localhost</userinput>
3498 Printer Driver mydrivername successfully installed.
3502 You cannot repeat this step if it fails. It could fail even as a result of a simple typo. It will most likely
3503 have moved a part of the driver files into the <quote>2</quote> subdirectory. If this step fails, you need to
3504 go back to the fourth step and repeat it before you can try this one again. In this step, you need to choose a
3505 name for your driver. It is normally a good idea to use the same name as is used for the printer name;
3506 however, in big installations you may use this driver for a number of printers that obviously have different
3507 names, so the name of the driver is not fixed.
3512 <title>Verify where the driver files are now.</title>
3515 &rootprompt;<userinput>ls -l /etc/samba/drivers/W32X86/</userinput>
3517 drwxr-sr-x 2 root ntadmin 532 May 25 23:22 2
3518 drwxr-sr-x 2 root ntadmin 670 May 16 03:15 3
3520 &rootprompt;<userinput>ls -l /etc/samba/drivers/W32X86/2</userinput>
3523 -rwxr--r-- 1 root ntadmin 14234 May 25 23:21 cups.hlp
3524 -rwxr--r-- 1 root ntadmin 278380 May 13 13:53 cupsdrvr.dll
3525 -rwxr--r-- 1 root ntadmin 215848 May 13 13:53 cupsui.dll
3526 -rwxr--r-- 1 root ntadmin 169458 May 25 23:21 mysmbtstprn.PPD
3530 Notice how step 6 also moved the driver files to the appropriate
3531 subdirectory. Compare this with the situation after step 5.
3536 <title>(Optional.) Verify if Samba now recognizes the driver.</title>
3539 <indexterm><primary>rpcclient</primary><secondary>enumdrivers</secondary></indexterm>
3541 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'enumdrivers 3' \
3542 localhost | grep -B2 -A5 mydrivername</userinput>
3543 Printer Driver Info 3:
3545 Driver Name: [mydrivername]
3546 Architecture: [Windows NT x86]
3547 Driver Path: [\\kde-bitshop\print$\W32X86\2\cupsdrvr.dll]
3548 Datafile: [\\kde-bitshop\print$\W32X86\2\mysmbtstprn.PPD]
3549 Configfile: [\\kde-bitshop\print$\W32X86\2\cupsui.dll]
3550 Helpfile: [\\kde-bitshop\print$\W32X86\2\cups.hlp]
3554 Remember, this command greps for the name you chose for the
3555 driver in step 6. This command must succeed before you can proceed.
3560 <para><title>Tell Samba which printer should use these driver files (<command>setdriver</command>).</title></para>
3563 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3565 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'setdriver mysmbtstprn mydrivername' \
3566 localhost</userinput>
3567 Successfully set mysmbtstprn to driver mydrivername
3571 Since you can bind any printer name (print queue) to any driver, this is a convenient way to set up many
3572 queues that use the same driver. You do not need to repeat all the previous steps for the setdriver command to
3573 succeed. The only preconditions are that <command>enumdrivers</command> must find the driver and
3574 <command>enumprinters</command> must find the printer.
3579 <title>(Optional) Verify if Samba has recognized this association.</title>
3582 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3583 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3584 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3586 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \
3587 | grep driver</userinput>
3588 drivername:[mydrivername]
3590 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \
3591 | grep -C4 driv</userinput>
3592 servername:[\\kde-bitshop]
3593 printername:[\\kde-bitshop\mysmbtstprn]
3594 sharename:[mysmbtstprn]
3596 drivername:[mydrivername]
3597 comment:[mysmbtstprn]
3600 printprocessor:[winprint]
3602 &rootprompt;<userinput>rpcclient -U root%xxxx -c 'getdriver mysmbtstprn' localhost</userinput>
3604 Printer Driver Info 3:
3606 Driver Name: [mydrivername]
3607 Architecture: [Windows NT x86]
3608 Driver Path: [\\kde-bitshop\print$\W32X86\2\cupsdrvr.dll]
3609 Datafile: [\\kde-bitshop\print$\W32X86\2\mysmbtstprn.PPD]
3610 Configfile: [\\kde-bitshop\print$\W32X86\2\cupsui.dll]
3611 Helpfile: [\\kde-bitshop\print$\W32X86\2\cups.hlp]
3613 Defaultdatatype: [RAW]
3615 Defaultdatatype: [RAW]
3617 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'enumprinters' localhost \
3618 | grep mysmbtstprn</userinput>
3619 name:[\\kde-bitshop\mysmbtstprn]
3620 description:[\\kde-bitshop\mysmbtstprn,mydrivername,mysmbtstprn]
3621 comment:[mysmbtstprn]
3626 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3627 Compare these results with the ones from steps 2 and 3. Every one of these commands show the driver is installed. Even
3628 the <command>enumprinters</command> command now lists the driver
3629 on the <quote>description</quote> line.
3634 <title>(Optional.) Tickle the driver into a correct
3635 device mode.</title>
3638 <indexterm><primary>"Printers" folder</primary></indexterm>
3639 You certainly know how to install the driver on the client. In case
3640 you are not particularly familiar with Windows, here is a short
3641 recipe: Browse the Network Neighborhood, go to the Samba server, and look
3642 for the shares. You should see all shared Samba printers.
3643 Double-click on the one in question. The driver should get
3644 installed and the network connection set up. Another way is to
3645 open the <guilabel>Printers (and Faxes)</guilabel> folder, right-click on the printer in
3646 question, and select <guilabel>Connect</guilabel> or <guilabel>Install</guilabel>. As a result, a new printer
3647 should appear in your client's local <guilabel>Printers (and Faxes)</guilabel>
3648 folder, named something like <guilabel>printersharename on Sambahostname</guilabel>.
3652 It is important that you execute this step as a Samba printer admin
3653 (as defined in &smb.conf;). Here is another method
3654 to do this on Windows XP. It uses a command line, which you may type
3655 into the <quote>DOS box</quote> (type root's smbpassword when prompted):
3659 &dosprompt;<userinput>runas /netonly /user:root "rundll32 printui.dll,PrintUIEntry \
3660 /in /n \\sambaserver\mysmbtstprn"</userinput>
3664 Change any printer setting once (like changing <emphasis><guilabel>portrait</guilabel> to
3665 <guilabel>landscape</guilabel></emphasis>), click on <guibutton>Apply</guibutton>, and change the setting back.
3670 <title>Install the printer on a client (Point'n'Print).</title>
3673 <indexterm significance="preferred"><primary>point 'n' print</primary></indexterm>
3675 &dosprompt;<userinput>rundll32 printui.dll,PrintUIEntry /in /n "\\sambaserver\mysmbtstprn"</userinput>
3677 If it does not work, it could be a permissions problem with the <smbconfsection name="[print$]"/> share.
3682 <title>(Optional) Print a test page.</title>
3684 <indexterm><primary>rundll32</primary></indexterm>
3686 &dosprompt;<userinput>rundll32 printui.dll,PrintUIEntry /p /n "\\sambaserver\mysmbtstprn"</userinput>
3690 Then hit [TAB] five times, [ENTER] twice, [TAB] once, and [ENTER] again, and march to the printer.
3695 <title>(Recommended.) Study the test page.</title>
3698 Hmmm. Just kidding! By now you know everything about printer installations and you do not need to read a word.
3699 Just put it in a frame and bolt it to the wall with the heading "MY FIRST RPCCLIENT-INSTALLED PRINTER"
3700 &smbmdash; why not just throw it away!
3705 <title>(Obligatory.) Enjoy. Jump. Celebrate your success.</title>
3708 &rootprompt;<userinput>echo "Cheeeeerioooooo! Success..." >> /var/log/samba/log.smbd</userinput>
3715 <title>Troubleshooting Revisited</title>
3718 <indexterm><primary>adddriver</primary></indexterm>
3719 The setdriver command will fail if in Samba's mind the queue is not
3720 already there. A successful installation displys the promising message that the:
3722 Printer Driver ABC successfully installed.
3724 following the <command>adddriver</command> parts of the procedure. But you may also see
3725 a disappointing message like this one:
3727 result was NT_STATUS_UNSUCCESSFUL
3728 </computeroutput></para>
3731 <indexterm><primary>lpstat</primary></indexterm>
3732 <indexterm><primary>rpcclient</primary></indexterm>
3733 It is not good enough that you can see the queue in CUPS, using the <command>lpstat -p ir85wm</command>
3734 command. A bug in most recent versions of Samba prevents the proper update of the queue list. The recognition
3735 of newly installed CUPS printers fails unless you restart Samba or send a HUP to all smbd processes. To verify
3736 if this is the reason why Samba does not execute the <command>setdriver</command> command successfully, check
3737 if Samba <quote>sees</quote> the printer:
3738 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3740 &rootprompt;<userinput>rpcclient transmeta -N -U'root%xxxx' -c 'enumprinters 0'|grep ir85wm</userinput>
3741 printername:[ir85wm]
3745 An alternate command could be this:
3746 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3748 &rootprompt;<userinput>rpcclient transmeta -N -U'root%secret' -c 'getprinter ir85wm' </userinput>
3749 cmd = getprinter ir85wm
3751 name:[\\transmeta\ir85wm]
3752 description:[\\transmeta\ir85wm,ir85wm,DPD]
3753 comment:[CUPS PostScript-Treiber for Windows NT/200x/XP]
3757 By the way, you can use these commands, plus a few more, of course, to install drivers on remote Windows NT print servers too!
3763 <title>The Printing <filename>*.tdb</filename> Files</title>
3766 <indexterm><primary>TDB</primary></indexterm>
3767 <indexterm><primary>connections.tdb</primary><seealso>TDB</seealso></indexterm>
3768 <indexterm><primary>printing.tdb</primary><seealso>TDB</seealso></indexterm>
3769 <indexterm><primary>share_info.tdb</primary><seealso>TDB</seealso></indexterm>
3770 <indexterm><primary>ntdrivers.tdb</primary><seealso>TDB</seealso></indexterm>
3771 <indexterm><primary>unexpected.tdb</primary><seealso>TDB</seealso></indexterm>
3772 <indexterm><primary>brlock.tdb</primary><seealso>TDB</seealso></indexterm>
3773 <indexterm><primary>locking.tdb</primary><seealso>TDB</seealso></indexterm>
3774 <indexterm><primary>ntforms.tdb</primary><seealso>TDB</seealso></indexterm>
3775 <indexterm><primary>messages.tdb</primary><seealso>TDB</seealso></indexterm>
3776 <indexterm><primary>ntprinters.tdb</primary><seealso>TDB</seealso></indexterm>
3777 <indexterm><primary>sessionid.tdb</primary><seealso>TDB</seealso></indexterm>
3778 <indexterm><primary>secrets.tdb</primary><seealso>TDB</seealso></indexterm>
3779 Some mystery is associated with the series of files with a tdb suffix appearing in every Samba installation.
3780 They are <filename>connections.tdb</filename>, <filename>printing.tdb</filename>,
3781 <filename>share_info.tdb</filename>, <filename>ntdrivers.tdb</filename>, <filename>unexpected.tdb</filename>,
3782 <filename>brlock.tdb</filename>, <filename>locking.tdb</filename>, <filename>ntforms.tdb</filename>,
3783 <filename>messages.tdb</filename> , <filename>ntprinters.tdb</filename>, <filename>sessionid.tdb</filename>,
3784 and <filename>secrets.tdb</filename>. What is their purpose?
3788 <title>Trivial Database Files</title>
3791 <indexterm><primary>TDB</primary></indexterm>
3792 A Windows NT (print) server keeps track of all information needed to serve its duty toward its clients by
3793 storing entries in the Windows registry. Client queries are answered by reading from the registry,
3794 Administrator or user configuration settings that are saved by writing into the registry. Samba and UNIX
3795 obviously do not have such a Registry. Samba instead keeps track of all client-related information in a series
3796 of <filename>*.tdb</filename> files. (TDB stands for trivial data base). These are often located in
3797 <filename>/var/lib/samba/</filename> or <filename>/var/lock/samba/</filename>. The printing-related files are
3798 <filename>ntprinters.tdb</filename>, <filename>printing.tdb</filename>,<filename>ntforms.tdb</filename>, and
3799 <filename>ntdrivers.tdb</filename>.
3804 <title>Binary Format</title>
3807 <filename>*.tdb</filename> files are not human readable. They are written in a binary format. <quote>Why not
3808 ASCII?</quote>, you may ask. <quote>After all, ASCII configuration files are a good and proven tradition on
3809 UNIX.</quote> The reason for this design decision by the Samba Team is mainly performance. Samba needs to be
3810 fast; it runs a separate <command>smbd</command> process for each client connection, in some environments many
3811 thousands of them. Some of these <command>smbds</command> might need to write-access the same
3812 <filename>*.tdb</filename> file <emphasis>at the same time</emphasis>. The file format of Samba's
3813 <filename>*.tdb</filename> files allows for this provision. Many smbd processes may write to the same
3814 <filename>*.tdb</filename> file at the same time. This wouldn't be possible with pure ASCII files.
3819 <title>Losing <filename>*.tdb</filename> Files</title>
3822 It is very important that all <filename>*.tdb</filename> files remain consistent over all write and read
3823 accesses. However, it may happen that these files <emphasis>do</emphasis> get corrupted. (A <command>kill -9
3824 `pidof smbd'</command> while a write access is in progress could do the damage, as could a power interruption,
3825 etc.). In cases of trouble, a deletion of the old printing-related <filename>*.tdb</filename> files may be the
3826 only option. After that, you need to re-create all print-related setups unless you have made a backup of the
3827 <filename>*.tdb</filename> files in time.
3832 <title>Using <command>tdbbackup</command></title>
3835 <indexterm><primary>TDB</primary><secondary>backing up</secondary><see>tdbbackup</see></indexterm>
3836 <indexterm><primary>tdbbackup</primary></indexterm>
3837 Samba ships with a little utility that helps the root user of your system to backup your
3838 <filename>*.tdb</filename> files. If you run it with no argument, it prints a usage message:
3840 &rootprompt;<userinput>tdbbackup</userinput>
3841 Usage: tdbbackup [options] <fname...>
3844 -h this help message
3845 -s suffix set the backup suffix
3846 -v verify mode (restore if corrupt)
3850 Here is how I backed up my <filename>printing.tdb</filename> file:
3854 &rootprompt;<userinput>ls</userinput>
3855 . browse.dat locking.tdb ntdrivers.tdb printing.tdb
3856 .. share_info.tdb connections.tdb messages.tdb ntforms.tdb
3857 printing.tdbkp unexpected.tdb brlock.tdb gmon.out namelist.debug
3858 ntprinters.tdb sessionid.tdb
3860 &rootprompt;<userinput>tdbbackup -s .bak printing.tdb</userinput>
3861 printing.tdb : 135 records
3863 &rootprompt;<userinput>ls -l printing.tdb*</userinput>
3864 -rw------- 1 root root 40960 May 2 03:44 printing.tdb
3865 -rw------- 1 root root 40960 May 2 03:44 printing.tdb.bak
3872 <title>CUPS Print Drivers from Linuxprinting.org</title>
3875 <indexterm><primary>Linuxprinting.org</primary></indexterm>
3876 CUPS ships with good support for HP LaserJet-type printers. You can install the generic driver as follows:
3877 <indexterm><primary>lpadmin</primary></indexterm>
3879 &rootprompt;<userinput>lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -m laserjet.ppd</userinput>
3883 The <option>-m</option> switch will retrieve the <filename>laserjet.ppd</filename> from the standard
3884 repository for not-yet-installed PPDs, which CUPS typically stores in
3885 <filename>/usr/share/cups/model</filename>. Alternatively, you may use <option>-P /path/to/your.ppd</option>.
3889 The generic <filename>laserjet.ppd,</filename> however, does not support every special option for every
3890 LaserJet-compatible model. It constitutes a sort of <quote>least common denominator</quote> of all the models.
3891 If for some reason you must pay for the commercially available ESP Print Pro drivers, your first move should
3892 be to consult the database on the <ulink noescape="1"
3893 url="http://www.linuxprinting.org/printer_list.cgi">Linuxprinting</ulink> Web site. Linuxprinting.org has
3894 excellent recommendations about which driver is best used for each printer. Its database is kept current by
3895 the tireless work of Till Kamppeter from Mandrakesoft, who is also the principal author of the
3896 <command>foomatic-rip</command> utility.
3900 <indexterm><primary>foomatic-rip</primary></indexterm>
3901 <indexterm><primary>cupsomatic</primary></indexterm>
3902 <indexterm><primary>Adobe PPD</primary></indexterm>
3903 The former <command>cupsomatic</command> concept is now being replaced by the new successor, a much more
3904 powerful <command>foomatic-rip</command>. <command>cupsomatic</command> is no longer maintained. Here is the
3905 new URL to the <ulink noescape="1" url="http://www.linuxprinting.org/driver_list.cgi">Foomatic-3.0</ulink>
3906 database. If you upgrade to <command>foomatic-rip</command>, remember to also upgrade to the new-style PPDs
3907 for your Foomatic-driven printers. foomatic-rip will not work with PPDs generated for the old
3908 <command>cupsomatic</command>. The new-style PPDs are 100% compliant with the Adobe PPD specification. They
3909 are also intended to be used by Samba and the cupsaddsmb utility, to provide the driver files for the Windows
3914 <title>foomatic-rip and Foomatic Explained</title>
3918 <indexterm significance="preferred"><primary>foomatic</primary></indexterm>
3919 <indexterm significance="preferred"><primary>foomatic-rip</primary></indexterm>
3920 Nowadays, most Linux distributions rely on the utilities from the <ulink
3921 url="http://www.linuxprinting.org/">Linuxprinting.org</ulink> to create their printing-related software
3922 (which, by the way, works on all UNIXes and on Mac OS X and Darwin, too). The utilities from this sire have a
3923 very end-user-friendly interface that allows for an easy update of drivers and PPDs for all supported models,
3924 all spoolers, all operating systems, and all package formats (because there is none). Its history goes back a
3929 Recently, Foomatic has achieved the astonishing milestone of <ulink
3930 url="http://www.linuxprinting.org/printer_list.cgi?make=Anyone">1,000 listed</ulink> printer models.
3931 Linuxprinting.org keeps all the important facts about printer drivers, supported models, and which options are
3932 available for the various driver/printer combinations in its <ulink
3933 url="http://www.linuxprinting.org/foomatic.html">Foomatic</ulink> database. Currently there are <ulink
3934 url="http://www.linuxprinting.org/driver_list.cgi">245 drivers</ulink> in the database. Many drivers support
3935 various models, and many models may be driven by different drivers &smbmdash; its your choice!
3939 <title>690 <quote>Perfect</quote> Printers</title>
3942 <indexterm><primary>Windows PPD</primary></indexterm>
3943 At present, there are 690 devices dubbed as working perfectly: 181 are <emphasis>mostly</emphasis> perfect, 96
3944 are <emphasis>partially</emphasis> perfect, and 46 are paperweights. Keeping in mind that most of these are
3945 non-PostScript models (PostScript printers are automatically supported by CUPS to perfection by using their
3946 own manufacturer-provided Windows PPD), and that a multifunctional device never qualifies as working perfectly
3947 if it does not also scan and copy and fax under GNU/Linux &smbmdash; then this is a truly astonishing
3948 achievement! Three years ago the number was not more than 500, and Linux or UNIX printing at the time wasn't
3949 anywhere near the quality it is today.
3954 <title>How the Printing HOWTO Started It All</title>
3957 A few years ago <ulink url="http://www2.picante.com/">Grant Taylor</ulink> started it all. The
3958 roots of today's Linuxprinting.org are in the first <ulink
3959 url="http://www.linuxprinting.org/foomatic2.9/howto/">Linux Printing HOWTO</ulink> that he authored. As a
3960 side-project to this document, which served many Linux users and admins to guide their first steps in this
3961 complicated and delicate setup (to a scientist, printing is <quote>applying a structured deposition of
3962 distinct patterns of ink or toner particles on paper substrates</quote>), he started to build in a little
3963 Postgres database with information about the hardware and driver zoo that made up Linux printing of the time.
3964 This database became the core component of today's Foomatic collection of tools and data. In the meantime, it
3965 has moved to an XML representation of the data.
3970 <title>Foomatic's Strange Name</title>
3974 <indexterm><primary>foomatic</primary></indexterm>
3975 <quote>Why the funny name?</quote> you ask. When it really took off, around spring 2000, CUPS was far less
3976 popular than today, and most systems used LPD, LPRng, or even PDQ to print. CUPS shipped with a few generic
3977 drivers (good for a few hundred different printer models). These didn't support many device-specific options.
3978 CUPS also shipped with its own built-in rasterization filter (<parameter>pstoraster</parameter>, derived from
3979 Ghostscript). On the other hand, CUPS provided brilliant support for <emphasis>controlling</emphasis> all
3980 printer options through standardized and well-defined PPD files. Plus, CUPS was designed to be easily
3985 Taylor already had in his database a respectable compilation of facts about many more printers and the
3986 Ghostscript <quote>drivers</quote> they run with. His idea, to generate PPDs from the database information and
3987 use them to make standard Ghostscript filters work within CUPS, proved to work very well. It also killed
3988 several birds with one stone:
3992 <listitem><para>It made all current and future Ghostscript filter
3993 developments available for CUPS.</para></listitem>
3995 <listitem><para>It made available a lot of additional printer models
3996 to CUPS users (because often the traditional Ghostscript way of
3997 printing was the only one available).</para></listitem>
3999 <listitem><para>It gave all the advanced CUPS options (Web interface,
4000 GUI driver configurations) to users wanting (or needing) to use
4001 Ghostscript filters.</para></listitem>
4006 <title>cupsomatic, pdqomatic, lpdomatic, directomatic</title>
4009 <indexterm><primary>cupsomatic</primary></indexterm>
4010 <indexterm><primary>CUPS-PPD</primary></indexterm>
4011 <indexterm><primary>PPD</primary><secondary>CUPS</secondary><see>CUPS-PPD</see></indexterm>
4012 CUPS worked through a quickly hacked-up filter script named <ulink
4013 url="http://www.linuxprinting.org/download.cgi?filename=cupsomatic&show=0">cupsomatic</ulink>. cupsomatic
4014 ran the printfile through Ghostscript, constructing automatically the rather complicated command line needed.
4015 It just needed to be copied into the CUPS system to make it work. To configure the way cupsomatic controls the
4016 Ghostscript rendering process, it needs a CUPS-PPD. This PPD is generated directly from the contents of the
4017 database. For CUPS and the respective printer/filter combo, another Perl script named CUPS-O-Matic did the PPD
4018 generation. After that was working, Taylor implemented within a few days a similar thing for two other
4019 spoolers. Names chosen for the config-generator scripts were <ulink
4020 url="http://www.linuxprinting.org/download.cgi?filename=lpdomatic&show=0">PDQ-O-Matic</ulink> (for PDQ)
4021 and <ulink url="http://www.linuxprinting.org/download.cgi?filename=lpdomatic&show=0">LPD-O-Matic</ulink>
4022 (for &smbmdash; you guessed it &smbmdash; LPD); the configuration here didn't use PPDs but other
4023 spooler-specific files.
4027 From late summer of that year, <ulink url="http://www.linuxprinting.org/till/">Till Kamppeter</ulink> started
4028 to put work into the database. Kamppeter had been newly employed by <ulink
4029 url="http://www.mandrakesoft.com/">Mandrakesoft</ulink> to convert its printing system over to CUPS, after
4030 they had seen his <ulink url="http://www.fltk.org/">FLTK</ulink>-based <ulink
4031 url="http://cups.sourceforge.net/xpp/">XPP</ulink> (a GUI front-end to the CUPS lp-command). He added a huge
4032 amount of new information and new printers. He also developed the support for other spoolers, like <ulink
4033 url="http://ppr.sourceforge.net/">PPR</ulink> (via ppromatic), <ulink
4034 url="http://sourceforge.net/projects/lpr/">GNUlpr</ulink>, and <ulink
4035 url="http://www.lprng.org/">LPRng</ulink> (both via an extended lpdomatic) and spooler-less printing (<ulink
4036 url="http://www.linuxprinting.org/download.cgi?filename=directomatic&show=0">directomatic</ulink>).
4040 So, to answer your question, <quote>Foomatic</quote> is the general name for all the overlapping code and data
4041 behind the <quote>*omatic</quote> scripts. Foomatic, up to versions 2.0.x, required (ugly) Perl data
4042 structures attached to Linuxprinting.org PPDs for CUPS. It had a different <quote>*omatic</quote> script for
4043 every spooler, as well as different printer configuration files.
4048 <title>The <emphasis>Grand Unification</emphasis> Achieved</title>
4051 <indexterm><primary>foomatic-rip</primary></indexterm>
4052 This has all changed in Foomatic versions 2.9 (beta) and released as <quote>stable</quote> 3.0. It has now
4053 achieved the convergence of all *omatic scripts and is called the <ulink
4054 url="http://www.linuxprinting.org/foomatic2.9/download.cgi?filename=foomatic-rip&show=0">foomatic-rip</ulink>.
4055 This single script is the unification of the previously different spooler-specific *omatic scripts.
4056 foomatic-rip is used by all the different spoolers alike, and because it can read PPDs (both the original
4057 PostScript printer PPDs and the Linuxprinting.org-generated ones), all of a sudden all supported spoolers can
4058 have the power of PPDs at their disposal. Users only need to plug foomatic-rip into their system. For users
4059 there is improved media type and source support &smbmdash; paper sizes and trays are easier to configure.
4063 <indexterm><primary>PPDs</primary></indexterm>
4064 <indexterm><primary>Foomatic tutorial</primary></indexterm>
4065 <indexterm><primary>LinuxKongress2002</primary></indexterm>
4066 Also, the new generation of Linuxprinting.org PPDs no longer contains Perl data structures. If you are a
4067 distro maintainer and have used the previous version of Foomatic, you may want to give the new one a spin, but
4068 remember to generate a new-version set of PPDs via the new <ulink
4069 url="http://www.linuxprinting.org/download/foomatic/foomatic-db-engine-3.0.0beta1.tar.gz">foomatic-db-engine!</ulink>.
4070 Individual users just need to generate a single new PPD specific to their model by <ulink
4071 url="http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/II.Foomatic-User/II.tutorial-handout-foomatic-user.html">following
4072 the steps</ulink> outlined in the Foomatic tutorial or in this chapter. This new development is truly amazing.
4076 <indexterm><primary>foomatic-rip</primary></indexterm>
4077 <indexterm><primary>Adobe</primary></indexterm>
4078 <indexterm><primary>printer drivers</primary></indexterm>
4079 foomatic-rip is a very clever wrapper around the need to run Ghostscript with a different syntax, options,
4080 device selections, and/or filters for each different printer or spooler. At the same time, it can read the PPD
4081 associated with a print queue and modify the print job according to the user selections. Together with this
4082 comes the 100% compliance of the new Foomatic PPDs with the Adobe spec. Some innovative features of the
4083 Foomatic concept may surprise users. It will support custom paper sizes for many printers and will support
4084 printing on media drawn from different paper trays within the same job (in both cases, even where there is no
4085 support for this from Windows-based vendor printer drivers).
4090 <title>Driver Development Outside</title>
4093 <indexterm><primary>Linuxprinting.org</primary></indexterm>
4094 Most driver development itself does not happen within Linuxprinting.org. Drivers are written by independent
4095 maintainers. Linuxprinting.org just pools all the information and stores it in its database. In addition, it
4096 also provides the Foomatic glue to integrate the many drivers into any modern (or legacy) printing system
4101 Speaking of the different driver development groups, most of the work is currently done in three projects:
4106 <indexterm><primary>Omni</primary></indexterm>
4107 <ulink url="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/">Omni</ulink>
4108 &smbmdash; a free software project by IBM that tries to convert its printer
4109 driver knowledge from good-ol' OS/2 times into a modern, modular,
4110 universal driver architecture for Linux/UNIX (still beta). This
4111 currently supports 437 models.</para></listitem>
4114 <indexterm><primary>HPIJS</primary></indexterm>
4115 <ulink url="http://hpinkjet.sf.net/">HPIJS</ulink> &smbmdash;
4116 a free software project by HP to provide the support for its own
4117 range of models (very mature, printing in most cases is perfect and
4118 provides true photo quality). This currently supports 369
4119 models.</para></listitem>
4122 <indexterm><primary>Gimp-Print</primary></indexterm>
4123 <ulink url="http://gimp-print.sf.net/">Gimp-Print</ulink> &smbmdash; a free software
4124 effort, started by Michael Sweet (also lead developer for CUPS), now
4125 directed by Robert Krawitz, which has achieved an amazing level of
4126 photo print quality (many Epson users swear that its quality is
4127 better than the vendor drivers provided by Epson for the Microsoft
4128 platforms). This currently supports 522 models.</para></listitem>
4133 <title>Forums, Downloads, Tutorials, Howtos (Also for Mac OS X and Commercial UNIX)</title>
4136 Linuxprinting.org today is the one-stop shop to download printer drivers. Look for printer information and
4137 <ulink url="http://www.linuxprinting.org//kpfeifle/LinuxKongress2002/Tutorial/">tutorials</ulink> or solve
4138 printing problems in its popular <ulink url="http://www.linuxprinting.org/newsportal/">forums</ulink>. This
4139 forum is not just for GNU/Linux users, but admins of <ulink url="http://www.linuxprinting.org/macosx/">
4140 commercial UNIX systems</ulink> are also going there, and the relatively new
4141 <ulink url="http://www.linuxprinting.org/newsportal/thread.php3?name=linuxprinting.macosx.general">Mac OS X
4142 forum</ulink> has turned out to be one of the most frequented forums after only a few weeks.
4146 <indexterm><primary>Mandriva</primary></indexterm>
4147 <indexterm><primary>Mandrake</primary></indexterm>
4148 <indexterm><primary>Conectiva</primary></indexterm>
4149 Linuxprinting.org and the Foomatic driver wrappers around Ghostscript are now a standard tool-chain for
4150 printing on all the important distros. Most of them also have CUPS underneath. While in recent years most
4151 printer data had been added by Kamppeter, many additional contributions came from engineers with SuSE, Red
4152 Hat, Conectiva, Debian, and others. Vendor-neutrality is an important goal of the Foomatic project. Mandrake
4153 and Conectiva have merged and are now called Mandriva.
4157 Till Kamppeter from Mandrakesoft is doing an excellent job in his spare time to maintain Linuxprinting.org and
4158 Foomatic. So if you use it often, please send him a note showing your appreciation.
4163 <title>Foomatic Database-Generated PPDs</title>
4166 <indexterm><primary>Foomatic database</primary></indexterm>
4167 <indexterm><primary>XML-based datasets</primary></indexterm>
4168 <indexterm><primary>kprinter</primary></indexterm>
4169 <indexterm><primary>gtklp</primary></indexterm>
4170 <indexterm><primary>xpp</primary></indexterm>
4171 <indexterm><primary>HP Photosmart</primary></indexterm>
4172 <indexterm><primary>Epson Stylus inkjet</primary></indexterm>
4173 <indexterm><primary>non-PostScript printers</primary></indexterm>
4174 <indexterm><primary>raster</primary></indexterm>
4175 The Foomatic database is an amazing piece of ingenuity in itself. Not only does it keep the printer and driver
4176 information, but it is organized in a way that it can generate PPD files on the fly from its internal
4177 XML-based datasets. While these PPDs are modeled to the Adobe specification of PPDs, the
4178 Linuxprinting.org/Foomatic-PPDs do not normally drive PostScript printers. They are used to describe all the
4179 bells and whistles you could ring or blow on an Epson Stylus inkjet, or an HP Photosmart, or what-have-you.
4180 The main trick is one little additional line, not envisaged by the PPD specification, starting with the
4181 <parameter>*cupsFilter</parameter> keyword. It tells the CUPS daemon how to proceed with the PostScript print
4182 file (old-style Foomatic-PPDs named the cupsomatic filter script, while the new-style PPDs are now call
4183 foomatic-rip). This filter script calls Ghostscript on the host system (the recommended variant is ESP
4184 Ghostscript) to do the rendering work. foomatic-rip knows which filter or internal device setting it should
4185 ask from Ghostscript to convert the PostScript print job into a raster format ready for the target device.
4186 This usage of PPDs to describe the options of non-PostScript printers was the invention of the CUPS
4187 developers. The rest is easy. GUI tools (like KDE's marvelous <ulink
4188 url="http://printing.kde.org/overview/kprinter.phtml">kprinter</ulink> or the GNOME <ulink
4189 url="http://gtklp.sourceforge.net/">gtklp</ulink> xpp and the CUPS Web interface) read the PPD as well and use
4190 this information to present the available settings to the user as an intuitive menu selection.
4196 <title>foomatic-rip and Foomatic PPD Download and Installation</title>
4199 Here are the steps to install a foomatic-rip-driven LaserJet 4 Plus-compatible
4200 printer in CUPS (note that recent distributions of SuSE, UnitedLinux and
4201 Mandrake may ship with a complete package of Foomatic-PPDs plus the
4202 <command>foomatic-rip</command> utility. Going directly to
4203 Linuxprinting.org ensures that you get the latest driver/PPD files).
4207 <listitem><para>Open your browser at the Linuxprinting.org printer list <ulink url="http://www.linuxprinting.org/printer_list.cgi">page.</ulink>
4210 <listitem><para>Check the complete list of printers in the
4211 <ulink url="http://www.linuxprinting.org/printer_list.cgi?make=Anyone">database.</ulink>.
4214 <listitem><para>Select your model and click on the link.
4217 <listitem><para>You'll arrive at a page listing all drivers working with this
4218 model (for all printers, there will always be <emphasis>one</emphasis>
4219 recommended driver. Try this one first).
4222 <listitem><para>In our case (HP LaserJet 4 Plus), we'll arrive at the default driver for the
4223 <ulink url="http://www.linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_4_Plus">HP-LaserJet 4 Plus.</ulink>
4226 <listitem><para>The recommended driver is ljet4.</para></listitem>
4228 <listitem><para>Several links are provided here. You should visit them all if you
4229 are not familiar with the Linuxprinting.org database.
4232 <listitem><para>There is a link to the database page for the
4233 <ulink url="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4">ljet4</ulink>.
4234 On the driver's page, you'll find important and detailed information
4235 about how to use that driver within the various available
4236 spoolers.</para></listitem>
4238 <listitem><para>Another link may lead you to the home page of the
4239 author of the driver.</para></listitem>
4241 <listitem><para>Important links are the ones that provide hints with
4242 setup instructions for <ulink noescape="1" url="http://www.linuxprinting.org/cups-doc.html">CUPS</ulink>;
4243 <ulink url="http://www.linuxprinting.org/pdq-doc.html">PDQ</ulink>;
4244 <ulink url="http://www.linuxprinting.org/lpd-doc.html">LPD, LPRng, and GNUlpr</ulink>);
4245 as well as <ulink url="http://www.linuxprinting.org/ppr-doc.html">PPR</ulink>
4246 or <quote>spoolerless</quote> <ulink url="http://www.linuxprinting.org/direct-doc.html">printing</ulink>.
4249 <listitem><para>You can view the PPD in your browser through this link:
4250 <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>
4251 </para></listitem> <listitem><para>Most importantly, you can also generate and download
4252 the <ulink url="http://www.linuxprinting.org/ppd-o-matic.cgi?driver=ljet4&printer=HP-LaserJet_4_Plus&show=0">PPD</ulink>.
4255 <listitem><para>The PPD contains all the information needed to use our
4256 model and the driver; once installed, this works transparently
4257 for the user. Later you'll only need to choose resolution, paper size,
4258 and so on, from the Web-based menu, or from the print dialog GUI, or from
4259 the command line.</para></listitem>
4261 <listitem><para>If you ended up on the drivers
4262 <ulink url="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4">page</ulink>,
4263 you can choose to use the <quote>PPD-O-Matic</quote> online PPD generator
4264 program.</para></listitem>
4266 <listitem><para>Select the exact model and check either <guilabel>Download</guilabel> or
4267 <guilabel>Display PPD file</guilabel> and click <guilabel>Generate PPD file</guilabel>.</para></listitem>
4269 <listitem><para>If you save the PPD file from the browser view, please
4270 do not use cut and paste (since it could possibly damage line endings
4271 and tabs, which makes the PPD likely to fail its duty), but use <guimenuitem>Save
4272 as...</guimenuitem> in your browser's menu. (It is best to use the <guilabel>Download</guilabel> option
4273 directly from the Web page.)</para></listitem>
4275 <listitem><para>Another interesting part on each driver page is
4276 the <guimenuitem>Show execution details</guimenuitem> button. If you
4277 select your printer model and click on that button,
4278 a complete Ghostscript command line will be displayed, enumerating all options
4279 available for that combination of driver and printer model. This is a great way to
4280 <quote>learn Ghostscript by doing</quote>. It is also an excellent cheat sheet
4281 for all experienced users who need to reconstruct a good command line
4282 for that darned printing script, but can't remember the exact
4283 syntax. </para></listitem>
4285 <listitem><para>Sometime during your visit to Linuxprinting.org, save
4286 the PPD to a suitable place on your hard disk, say
4287 <filename>/path/to/my-printer.ppd</filename> (if you prefer to install
4288 your printers with the help of the CUPS Web interface, save the PPD to
4289 the <filename>/usr/share/cups/model/</filename> path and restart
4290 cupsd).</para></listitem>
4292 <listitem><para>Then install the printer with a suitable command line,
4297 &rootprompt;<userinput>lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E \
4298 -P path/to/my-printer.ppd</userinput>
4299 </screen></para></listitem>
4301 <listitem><para>For all the new-style <quote>Foomatic-PPDs</quote>
4302 from Linuxprinting.org, you also need a special CUPS filter named
4306 <listitem><para>The foomatic-rip Perl script itself also makes some
4307 interesting <ulink url="http://www.linuxprinting.org/foomatic2.9/download.cgi?filename=foomatic-rip&show=1">reading</ulink>
4308 because it is well documented by Kamppeter's in-line comments (even
4309 non-Perl hackers will learn quite a bit about printing by reading
4310 it).</para></listitem>
4312 <listitem><para>Save foomatic-rip either directly in
4313 <filename>/usr/lib/cups/filter/foomatic-rip</filename> or somewhere in
4314 your $PATH (and remember to make it world-executable). Again,
4315 do not save by copy and paste but use the appropriate link or the
4316 <guimenuitem>Save as...</guimenuitem> menu item in your browser.</para></listitem>
4318 <listitem><para>If you save foomatic-rip in your $PATH, create a symlink:
4320 &rootprompt;<userinput>cd /usr/lib/cups/filter/ ; ln -s `which foomatic-rip'</userinput>
4325 CUPS will discover this new available filter at startup after restarting
4326 cupsd.</para></listitem>
4330 Once you print to a print queue set up with the Foomatic PPD, CUPS will insert the appropriate commands and
4331 comments into the resulting PostScript job file. foomatic-rip is able to read and act upon these and uses some
4332 specially encoded Foomatic comments embedded in the job file. These in turn are used to construct
4333 (transparently for you, the user) the complicated Ghostscript command line telling the printer driver exactly
4334 how the resulting raster data should look and which printer commands to embed into the data stream. You need:
4338 <listitem><para>A <quote>foomatic+something</quote> PPD &smbmdash; but this is not enough
4339 to print with CUPS (it is only <emphasis>one</emphasis> important
4340 component).</para></listitem>
4342 <listitem><para>The <parameter>foomatic-rip</parameter> filter script (Perl) in
4343 <filename>/usr/lib/cups/filters/</filename>.</para></listitem>
4345 <listitem><para>Perl to make foomatic-rip run.</para></listitem>
4347 <listitem><para>Ghostscript (because it is doing the main work,
4348 controlled by the PPD/foomatic-rip combo) to produce the raster data
4349 fit for your printer model's consumption.</para></listitem>
4351 <listitem><para>Ghostscript <emphasis>must</emphasis> (depending on
4352 the driver/model) contain support for a certain device representing
4353 the selected driver for your model (as shown by <command>gs -h</command>).</para></listitem>
4355 <listitem><para>foomatic-rip needs a new version of PPDs (PPD versions
4356 produced for cupsomatic do not work with foomatic-rip).</para></listitem>
4362 <title>Page Accounting with CUPS</title>
4366 <indexterm><primary>CUPS</primary><secondary>Page Accounting</secondary></indexterm>
4367 Often there are questions regarding print quotas where Samba users (that is, Windows clients) should not be
4368 able to print beyond a certain number of pages or data volume per day, week, or month. This feature is
4369 dependent on the real print subsystem you're using. Samba's part is always to receive the job files from the
4370 clients (filtered <emphasis>or</emphasis> unfiltered) and hand them over to this printing subsystem.
4374 Of course one could hack things with one's own scripts. But then there is CUPS. CUPS supports quotas that can
4375 be based on the size of jobs or on the number of pages or both, and can span any time period you want.
4379 <title>Setting Up Quotas</title>
4382 <indexterm><primary>CUPS</primary><secondary>quotas</secondary></indexterm>
4383 This is an example command of how root would set a print quota in CUPS, assuming an existing printer named
4384 <quote>quotaprinter</quote>:
4385 <indexterm><primary>lpadmin</primary></indexterm>
4387 &rootprompt;<userinput>lpadmin -p quotaprinter -o job-quota-period=604800 \
4388 -o job-k-limit=1024 -o job-page-limit=100</userinput>
4392 This would limit every single user to print no more than 100 pages or 1024 KB of
4393 data (whichever comes first) within the last 604,800 seconds ( = 1 week).
4398 <title>Correct and Incorrect Accounting</title>
4401 For CUPS to count correctly, the printfile needs to pass the CUPS pstops filter; otherwise it uses a dummy
4402 count of <quote>one</quote>. Some print files do not pass it (e.g., image files), but then those are mostly
4403 one-page jobs anyway. This also means that proprietary drivers for the target printer running on the client
4404 computers and CUPS/Samba, which then spool these files as <quote>raw</quote> (i.e., leaving them untouched,
4405 not filtering them), will be counted as one-pagers too!
4409 You need to send PostScript from the clients (i.e., run a PostScript driver there) to have the chance to get
4410 accounting done. If the printer is a non-PostScript model, you need to let CUPS do the job to convert the file
4411 to a print-ready format for the target printer. This is currently working for about a thousand different
4412 printer models. Linuxprinting.org has a driver <ulink url="http://www.linuxprinting.org/printer_list.cgi">list</ulink>.
4417 <title>Adobe and CUPS PostScript Drivers for Windows Clients</title>
4420 <indexterm><primary>Adobe PostScript</primary></indexterm>
4421 <indexterm><primary>pstops</primary></indexterm>
4422 <indexterm><primary>PPD</primary></indexterm>
4423 <indexterm><primary>pstoraster</primary></indexterm>
4424 <indexterm><primary>PJL-header</primary></indexterm>
4425 Before CUPS 1.1.16, your only option was to use the Adobe PostScript driver on the Windows clients. The output
4426 of this driver was not always passed through the <command>pstops</command> filter on the CUPS/Samba side, and
4427 therefore was not counted correctly (the reason is that it often, depending on the PPD being used, wrote a
4428 PJL-header in front of the real PostScript, which caused CUPS to skip <command>pstops</command> and go
4429 directly to the <command>pstoraster</command> stage).
4433 From CUPS 1.1.16 and later releases, you can use the CUPS PostScript driver for Windows NT/200x/XP
4434 clients (which is tagged in the download area of <filename>http://www.cups.org/</filename> as the
4435 <filename>cups-samba-1.1.16.tar.gz</filename> package). It does <emphasis>not</emphasis> work for Windows
4436 9x/Me clients, but it guarantees:
4440 <listitem><para> <indexterm><primary>PJL</primary></indexterm> To not write a PJL-header.</para></listitem>
4442 <listitem><para>To still read and support all PJL-options named in the
4443 driver PPD with its own means.</para></listitem>
4445 <listitem><para>That the file will pass through the <command>pstops</command> filter
4446 on the CUPS/Samba server.</para></listitem>
4448 <listitem><para>To page-count correctly the print file.</para></listitem>
4452 You can read more about the setup of this combination in the man page for <command>cupsaddsmb</command> (which
4453 is only present with CUPS installed, and only current from CUPS 1.1.16).
4458 <title>The page_log File Syntax</title>
4461 <indexterm><primary>page_log</primary></indexterm>
4462 These are the items CUPS logs in the <filename>page_log</filename> for every page of a job:
4466 <listitem><para>Printer name</para></listitem>
4468 <listitem><para>User name</para></listitem>
4470 <listitem><para>Job ID</para></listitem>
4472 <listitem><para>Time of printing</para></listitem>
4474 <listitem><para>Page number</para></listitem>
4476 <listitem><para>Number of copies</para></listitem>
4478 <listitem><para>A billing information string (optional)</para></listitem>
4480 <listitem><para>The host that sent the job (included since version 1.1.19)</para></listitem>
4484 Here is an extract of my CUPS server's <filename>page_log</filename> file to illustrate the
4485 format and included items:
4489 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 1 3 #marketing 10.160.50.13
4490 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 2 3 #marketing 10.160.50.13
4491 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 3 3 #marketing 10.160.50.13
4492 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 4 3 #marketing 10.160.50.13
4493 Dig9110 boss 402 [22/Apr/2003:10:33:22 +0100] 1 440 finance-dep 10.160.51.33
4497 This was job ID <parameter>401</parameter>, printed on <parameter>tec_IS2027</parameter>
4498 by user <parameter>kurt</parameter>, a 64-page job printed in three copies, billed to
4499 <parameter>#marketing</parameter>, and sent from IP address <constant>10.160.50.13.</constant>
4500 The next job had ID <parameter>402</parameter>, was sent by user <parameter>boss</parameter>
4501 from IP address <constant>10.160.51.33</constant>, printed from one page 440 copies, and
4502 is set to be billed to <parameter>finance-dep</parameter>.
4507 <title>Possible Shortcomings</title>
4510 What flaws or shortcomings are there with this quota system?
4514 <listitem><para>The ones named above (wrongly logged job in case of
4515 printer hardware failure, and so on).</para></listitem>
4517 <listitem><para>In reality, CUPS counts the job pages that are being
4518 processed in <emphasis>software</emphasis> (that is, going through the
4519 RIP) rather than the physical sheets successfully leaving the
4520 printing device. Thus, if there is a jam while printing the fifth sheet out
4521 of 1,000 and the job is aborted by the printer, the page count will
4522 still show the figure of 1,000 for that job.</para></listitem>
4524 <listitem><para>All quotas are the same for all users (no flexibility
4525 to give the boss a higher quota than the clerk) and no support for
4526 groups.</para></listitem>
4528 <listitem><para>No means to read out the current balance or the
4529 <quote>used-up</quote> number of current quota.</para></listitem>
4531 <listitem><para>A user having used up 99 sheets of a 100 quota will
4532 still be able to send and print a 1,000 sheet job.</para></listitem>
4534 <listitem><para>A user being denied a job because of a filled-up quota
4535 does not get a meaningful error message from CUPS other than
4536 <quote>client-error-not-possible</quote>.</para></listitem>
4541 <title>Future Developments</title>
4544 This is the best system currently available, and there are huge
4545 improvements under development for CUPS 1.2:
4549 <listitem><para>Page counting will go into the backends (these talk
4550 directly to the printer and will increase the count in sync with the
4551 actual printing process; thus, a jam at the fifth sheet will lead to a
4552 stop in the counting).</para></listitem>
4554 <listitem><para>Quotas will be handled more flexibly.</para></listitem>
4556 <listitem><para>Probably there will be support for users to inquire
4557 about their accounts in advance.</para></listitem>
4559 <listitem><para>Probably there will be support for some other tools
4560 around this topic.</para></listitem>
4565 <title>Other Accounting Tools</title>
4568 Other accounting tools that can be used includes: PrintAnalyzer, pyKota, printbill, LogReport.
4569 For more information regarding these tools you can try a Google search.
4576 <title>Additional Material</title>
4579 A printer queue with <emphasis>no</emphasis> PPD associated to it is a
4580 <quote>raw</quote> printer, and all files will go directly there as received by the
4581 spooler. The exceptions are file types <parameter>application/octet-stream</parameter>
4582 that need the pass-through feature enabled. <quote>Raw</quote> queues do not do any
4583 filtering at all; they hand the file directly to the CUPS backend.
4584 This backend is responsible for sending the data to the device
4585 (as in the <quote>device URI</quote> notation: <filename>lpd://, socket://,
4586 smb://, ipp://, http://, parallel:/, serial:/, usb:/</filename>, and so on).
4590 cupsomatic/Foomatic are <emphasis>not</emphasis> native CUPS drivers
4591 and they do not ship with CUPS. They are a third-party add-on
4592 developed at Linuxprinting.org. As such, they are a brilliant hack to
4593 make all models (driven by Ghostscript drivers/filters in traditional
4594 spoolers) also work via CUPS, with the same (good or bad!) quality as
4595 in these other spoolers. <parameter>cupsomatic</parameter> is only a vehicle to execute a
4596 Ghostscript command line at that stage in the CUPS filtering chain
4597 where normally the native CUPS <parameter>pstoraster</parameter> filter would kick
4598 in. <parameter>cupsomatic</parameter> bypasses <parameter>pstoraster</parameter>, kidnaps the print file from CUPS,
4599 and redirects it to go through Ghostscript. CUPS accepts this
4600 because the associated cupsomatic/foomatic-PPD specifies:
4603 *cupsFilter: "application/vnd.cups-postscript 0 cupsomatic"
4606 This line persuades CUPS to hand the file to <parameter>cupsomatic</parameter> once it has
4607 successfully converted it to the MIME type
4608 <parameter>application/vnd.cups-postscript</parameter>. This conversion will not happen for
4609 jobs arriving from Windows that are autotyped
4610 <parameter>application/octet-stream</parameter>, with the according changes in
4611 <filename>/etc/cups/mime.types</filename> in place.
4615 CUPS is widely configurable and flexible, even regarding its filtering
4616 mechanism. Another workaround in some situations would be to have in
4617 <filename>/etc/cups/mime.types</filename> entries as follows:
4620 application/postscript application/vnd.cups-raw 0 -
4621 application/vnd.cups-postscript application/vnd.cups-raw 0 -
4624 This would prevent all PostScript files from being filtered (rather,
4625 they will through the virtual <emphasis>nullfilter</emphasis>
4626 denoted with <quote>-</quote>). This could only be useful for PostScript printers. If you
4627 want to print PostScript code on non-PostScript printers (provided they support ASCII
4628 text printing), an entry as follows could be useful:
4631 */* application/vnd.cups-raw 0 -
4634 and would effectively send <emphasis>all</emphasis> files to the
4635 backend without further processing.
4639 You could have the following entry:
4642 application/vnd.cups-postscript application/vnd.cups-raw 0 \
4643 my_PJL_stripping_filter
4646 You will need to write a <parameter>my_PJL_stripping_filter</parameter>
4647 (which could be a shell script) that parses the PostScript and removes the
4648 unwanted PJL. This needs to conform to CUPS filter design
4649 (mainly, receive and pass the parameters printername, job-id,
4650 username, jobtitle, copies, print options, and possibly the
4651 filename). It is installed as world executable into
4652 <filename>/usr/lib/cups/filters/</filename> and is called by CUPS
4653 if it encounters a MIME type <parameter>application/vnd.cups-postscript</parameter>.
4657 CUPS can handle <parameter>-o job-hold-until=indefinite</parameter>.
4658 This keeps the job in the queue on hold. It will only be printed
4659 upon manual release by the printer operator. This is a requirement in
4660 many central reproduction departments, where a few operators manage
4661 the jobs of hundreds of users on some big machine, where no user is
4662 allowed to have direct access (such as when the operators often need
4663 to load the proper paper type before running the 10,000 page job
4664 requested by marketing for the mailing, and so on).
4669 <title>Autodeletion or Preservation of CUPS Spool Files</title>
4672 <indexterm><primary>/var/spool/samba</primary></indexterm>
4673 <indexterm><primary>/var/spool/cups/</primary></indexterm>
4674 <indexterm><primary>cupsd.conf</primary></indexterm>
4675 Samba print files pass through two spool directories. One is the incoming directory managed by Samba (set in
4676 the <smbconfoption name="path">/var/spool/samba</smbconfoption> directive in the <smbconfsection
4677 name="[printers]"/> section of &smb.conf;). The other is the spool directory of your UNIX print subsystem. For
4678 CUPS it is normally <filename>/var/spool/cups/</filename>, as set by the <filename>cupsd.conf</filename>
4679 directive <filename>RequestRoot /var/spool/cups</filename>.
4683 <title>CUPS Configuration Settings Explained</title>
4686 Some important parameter settings in the CUPS configuration file
4687 <filename>cupsd.conf</filename> are:
4692 <varlistentry><term>PreserveJobHistory Yes</term>
4694 This keeps some details of jobs in cupsd's mind (well, it keeps the
4695 c12345, c12346, and so on, files in the CUPS spool directory, which does a
4696 similar job as the old-fashioned BSD-LPD control files). This is set
4697 to <quote>Yes</quote> as a default.
4698 </para></listitem></varlistentry>
4700 <varlistentry><term>PreserveJobFiles Yes</term>
4702 This keeps the job files themselves in cupsd's mind
4703 (it keeps the d12345, d12346, etc., files in the CUPS spool
4704 directory). This is set to <quote>No</quote> as the CUPS
4706 </para></listitem></varlistentry>
4708 <varlistentry><term><quote>MaxJobs 500</quote></term>
4710 This directive controls the maximum number of jobs
4711 that are kept in memory. Once the number of jobs reaches the limit,
4712 the oldest completed job is automatically purged from the system to
4713 make room for the new one. If all of the known jobs are still
4714 pending or active, then the new job will be rejected. Setting the
4715 maximum to 0 disables this functionality. The default setting is
4717 </para></listitem></varlistentry>
4721 (There are also additional settings for <parameter>MaxJobsPerUser</parameter> and
4722 <parameter>MaxJobsPerPrinter</parameter>.)
4727 <title>Preconditions</title>
4730 For everything to work as it should, you need to have three things:
4734 <listitem><para>A Samba smbd that is compiled against <filename>libcups</filename> (check
4735 on Linux by running <userinput>ldd `which smbd'</userinput>).</para></listitem>
4737 <listitem><para>A Samba-&smb.conf; setting of
4738 <smbconfoption name="printing">cups</smbconfoption>.</para></listitem>
4740 <listitem><para>Another Samba &smb.conf; setting of
4741 <smbconfoption name="printcap">cups</smbconfoption>.</para></listitem>
4745 In this case, all other manually set printing-related commands (like
4746 <smbconfoption name="print command"/>,
4747 <smbconfoption name="lpq command"/>,
4748 <smbconfoption name="lprm command"/>,
4749 <smbconfoption name="lppause command"/>, and
4750 <smbconfoption name="lpresume command"/>) are ignored, and they should normally have no
4751 influence whatsoever on your printing.
4756 <title>Manual Configuration</title>
4759 If you want to do things manually, replace the <smbconfoption name="printing">cups</smbconfoption>
4760 by <smbconfoption name="printing">bsd</smbconfoption>. Then your manually set commands may work
4761 (I haven't tested this), and a <smbconfoption name="print command">lp -d %P %s; rm %s</smbconfoption>
4762 may do what you need.
4768 <title>Printing from CUPS to Windows-Attached Printers</title>
4771 <indexterm><primary>smbspool</primary></indexterm>
4772 <indexterm><primary>backends</primary></indexterm>
4773 From time to time the question arises, how can you print <emphasis>to</emphasis> a Windows-attached printer
4774 <emphasis>from</emphasis> Samba? Normally the local connection from Windows host to printer would be done by
4775 USB or parallel cable, but this does not matter to Samba. From here only an SMB connection needs to be opened
4776 to the Windows host. Of course, this printer must be shared first. As you have learned by now, CUPS uses
4777 <emphasis>backends</emphasis> to talk to printers and other servers. To talk to Windows shared printers, you
4778 need to use the <filename>smb</filename> (surprise, surprise!) backend. Check if this is in the CUPS backend
4779 directory. This usually resides in <filename>/usr/lib/cups/backend/</filename>. You need to find an
4780 <filename>smb</filename> file there. It should be a symlink to <filename>smbspool</filename>, and the file
4781 must exist and be executable:
4783 &rootprompt;<userinput>ls -l /usr/lib/cups/backend/</userinput>
4785 drwxr-xr-x 3 root root 720 Apr 30 19:04 .
4786 drwxr-xr-x 6 root root 125 Dec 19 17:13 ..
4787 -rwxr-xr-x 1 root root 10692 Feb 16 21:29 canon
4788 -rwxr-xr-x 1 root root 10692 Feb 16 21:29 epson
4789 lrwxrwxrwx 1 root root 3 Apr 17 22:50 http -> ipp
4790 -rwxr-xr-x 1 root root 17316 Apr 17 22:50 ipp
4791 -rwxr-xr-x 1 root root 15420 Apr 20 17:01 lpd
4792 -rwxr-xr-x 1 root root 8656 Apr 20 17:01 parallel
4793 -rwxr-xr-x 1 root root 2162 Mar 31 23:15 pdfdistiller
4794 lrwxrwxrwx 1 root root 25 Apr 30 19:04 ptal -> /usr/sbin/ptal-cups
4795 -rwxr-xr-x 1 root root 6284 Apr 20 17:01 scsi
4796 lrwxrwxrwx 1 root root 17 Apr 2 03:11 smb -> /usr/bin/smbspool
4797 -rwxr-xr-x 1 root root 7912 Apr 20 17:01 socket
4798 -rwxr-xr-x 1 root root 9012 Apr 20 17:01 usb
4800 &rootprompt;<userinput>ls -l `which smbspool`</userinput>
4801 -rwxr-xr-x 1 root root 563245 Dec 28 14:49 /usr/bin/smbspool
4805 If this symlink does not exist, create it:
4807 &rootprompt;<userinput>ln -s `which smbspool` /usr/lib/cups/backend/smb</userinput>
4811 <indexterm><primary>smbspool</primary></indexterm>
4812 <indexterm><primary>troubleshooting</primary></indexterm>
4813 <command>smbspool</command> was written by Mike Sweet from the CUPS folks. It is included and ships with
4814 Samba. It may also be used with print subsystems other than CUPS, to spool jobs to Windows printer shares. To
4815 set up printer <replaceable>winprinter</replaceable> on CUPS, you need to have a driver for it. Essentially
4816 this means to convert the print data on the CUPS/Samba host to a format that the printer can digest (the
4817 Windows host is unable to convert any files you may send). This also means you should be able to print to the
4818 printer if it were hooked directly at your Samba/CUPS host. For troubleshooting purposes, this is what you
4819 should do to determine if that part of the process chain is in order. Then proceed to fix the network
4820 connection/authentication to the Windows host, and so on.
4824 To install a printer with the <parameter>smb</parameter> backend on CUPS, use this command:
4828 &rootprompt;<userinput>lpadmin -p winprinter -v smb://WINDOWSNETBIOSNAME/printersharename \
4829 -P /path/to/PPD</userinput>
4833 <indexterm><primary>PostScript printers</primary></indexterm>
4834 <indexterm><primary>PPD</primary></indexterm>
4835 <indexterm><primary>Windows NT PostScript driver</primary></indexterm>
4836 The PPD must be able to direct CUPS to generate the print data for the target model. For PostScript printers,
4837 just use the PPD that would be used with the Windows NT PostScript driver. But what can you do if the printer
4838 is only accessible with a password? Or if the printer's host is part of another workgroup? This is provided
4839 for: You can include the required parameters as part of the <filename>smb://</filename> device-URI like this:
4843 <listitem><para><filename>smb://WORKGROUP/WINDOWSNETBIOSNAME/printersharename</filename></para></listitem>
4844 <listitem><para><filename>smb://username:password@WORKGROUP/WINDOWSNETBIOSNAME/printersharename</filename></para></listitem>
4845 <listitem><para><filename>smb://username:password@WINDOWSNETBIOSNAME/printersharename</filename></para></listitem>
4849 Note that the device URI will be visible in the process list of the Samba server (e.g., when someone uses the
4850 <command>ps -aux</command> command on Linux), even if the username and passwords are sanitized before they get
4851 written into the log files. This is an inherently insecure option; however, it is the only one. Don't use it
4852 if you want to protect your passwords. Better share the printer in a way that does not require a password!
4853 Printing will only work if you have a working NetBIOS name resolution up and running. Note that this is a
4854 feature of CUPS and you do not necessarily need to have smbd running.
4860 <title>More CUPS Filtering Chains</title>
4863 The diagrams in <link linkend="cups1">Filtering Chain 1</link> and <link linkend="cups2">Filtering Chain with
4864 cupsomatic</link> show how CUPS handles print jobs.
4868 <title>Filtering Chain 1.</title>
4869 <imagefile>cups1</imagefile>
4874 <title>Filtering Chain with cupsomatic</title>
4875 <imagefile scale="45">cups2</imagefile>
4881 <title>Common Errors</title>
4884 <title>Windows 9x/Me Client Can't Install Driver</title>
4886 <para>For Windows 9x/Me, clients require the printer names to be eight
4887 characters (or <quote>8 plus 3 chars suffix</quote>) max; otherwise, the driver files
4888 will not get transferred when you want to download them from Samba.</para>
4892 <sect2 id="root-ask-loop">
4893 <title><quote>cupsaddsmb</quote> Keeps Asking for Root Password in Never-ending Loop</title>
4895 <para>Have you set <smbconfoption name="security">user</smbconfoption>? Have
4896 you used <command>smbpasswd</command> to give root a Samba account?
4897 You can do two things: open another terminal and execute
4898 <command>smbpasswd -a root</command> to create the account and
4899 continue entering the password into the first terminal. Or, break
4900 out of the loop by pressing Enter twice (without trying to type a
4904 If the error is <quote>Tree connect failed: NT_STATUS_BAD_NETWORK_NAME</quote>,
4905 you may have forgotten to create the <filename>/etc/samba/drivers</filename> directory.
4910 <title><quote>cupsaddsmb</quote> or <quote>rpcclient addriver</quote> Emit Error</title>
4913 If <command>cupsaddsmb</command>, or <command>rpcclient addriver</command> emit the error message
4914 WERR_BAD_PASSWORD, refer to <link linkend="root-ask-loop">the previous common error</link>.
4920 <title><quote>cupsaddsmb</quote> Errors</title>
4923 The use of <quote>cupsaddsmb</quote> gives <quote>No PPD file for printer...</quote>
4924 message while PPD file is present. What might the problem be?
4928 Have you enabled printer sharing on CUPS? This means, do you have a <literal><Location
4929 /printers>....</Location></literal> section in CUPS server's <filename>cupsd.conf</filename> that
4930 does not deny access to the host you run <quote>cupsaddsmb</quote> from? It <emphasis>could</emphasis> be an
4931 issue if you use cupsaddsmb remotely, or if you use it with a <option>-h</option> parameter:
4932 <userinput>cupsaddsmb -H sambaserver -h cupsserver -v printername</userinput>.
4935 <para>Is your <parameter>TempDir</parameter> directive in
4936 <filename>cupsd.conf</filename> set to a valid value, and is it writable?
4942 <title>Client Can't Connect to Samba Printer</title>
4944 <para>Use <command>smbstatus</command> to check which user
4945 you are from Samba's point of view. Do you have the privileges to
4946 write into the <smbconfsection name="[print$]"/>
4952 <title>New Account Reconnection from Windows 200x/XP Troubles</title>
4955 Once you are connected as the wrong user (for example, as <constant>nobody</constant>, which often occurs if
4956 you have <smbconfoption name="map to guest">bad user</smbconfoption>), Windows Explorer will not accept an
4957 attempt to connect again as a different user. There will not be any bytes transferred on the wire to Samba,
4958 but still you'll see a stupid error message that makes you think Samba has denied access. Use
4959 <command>smbstatus</command> to check for active connections. Kill the PIDs. You still can't re-connect, and
4960 you get the dreaded <computeroutput>You can't connect with a second account from the same
4961 machine</computeroutput> message as soon as you try. And you do not see a single byte arriving at Samba (see
4962 logs; use <quote>ethereal</quote>) indicating a renewed connection attempt. Shut all Explorer Windows. This
4963 makes Windows forget what it has cached in its memory as established connections. Then reconnect as the right
4964 user. The best method is to use a DOS terminal window and <emphasis>first</emphasis> do <userinput>net use z:
4965 \\&example.server.samba;\print$ /user:root</userinput>. Check with <command>smbstatus</command> that you are
4966 connected under a different account. Now open the <guilabel>Printers</guilabel> folder (on the Samba server in
4967 the <guilabel>Network Neighborhood</guilabel>), right-click on the printer in question, and select
4968 <guibutton>Connect....</guibutton>.
4973 <title>Avoid Being Connected to the Samba Server as the Wrong User</title>
4976 <indexterm><primary>smbstatus</primary></indexterm>
4977 You see per <command>smbstatus</command> that you are connected as user nobody, but you want to be root or
4978 printer admin. This is probably due to <smbconfoption name="map to guest">bad user</smbconfoption>, which
4979 silently connected you under the guest account when you gave (maybe by accident) an incorrect username. Remove
4980 <smbconfoption name="map to guest"/> if you want to prevent this.
4985 <title>Upgrading to CUPS Drivers from Adobe Drivers</title>
4988 This information came from a mailing list posting regarding problems experienced when
4989 upgrading from Adobe drivers to CUPS drivers on Microsoft Windows NT/200x/XP clients.
4992 <para>First delete all old Adobe-using printers. Then delete all old Adobe drivers. (On Windows 200x/XP, right-click in
4993 the background of <guilabel>Printers</guilabel> folder, select <guimenuitem>Server Properties...</guimenuitem>, select
4994 tab <guilabel>Drivers</guilabel>, and delete here).</para>
4998 <title>Can't Use <quote>cupsaddsmb</quote> on Samba Server, Which Is a PDC</title>
5000 <para>Do you use the <quote>naked</quote> root user name? Try to do it
5001 this way: <userinput>cupsaddsmb -U <replaceable>DOMAINNAME</replaceable>\\root -v
5002 <replaceable>printername</replaceable></userinput>> (note the two backslashes: the first one is
5003 required to <quote>escape</quote> the second one).</para>
5008 <title>Deleted Windows 200x Printer Driver Is Still Shown</title>
5010 <para>Deleting a printer on the client will not delete the
5011 driver too (to verify, right-click on the white background of the
5012 <guilabel>Printers</guilabel> folder, select <guimenuitem>Server Properties</guimenuitem> and click on the
5013 <guilabel>Drivers</guilabel> tab). These same old drivers will be re-used when you try to
5014 install a printer with the same name. If you want to update to a new
5015 driver, delete the old ones first. Deletion is only possible if no
5016 other printer uses the same driver.</para>
5020 <title>Windows 200x/XP Local Security Policies</title>
5022 <indexterm><primary>Local security policies</primary></indexterm>
5023 <indexterm><primary>unsigned drivers</primary></indexterm>
5024 <para>Local security policies may not allow the installation of unsigned drivers &smbmdash; <quote>local
5025 security policies</quote> may not allow the installation of printer drivers at all.</para>
5030 <title>Administrator Cannot Install Printers for All Local Users</title>
5033 <indexterm><primary>SMB printers</primary></indexterm>
5034 <indexterm><primary>IPP client</primary></indexterm>
5035 Windows XP handles SMB printers on a <quote>per-user</quote> basis.
5036 This means every user needs to install the printer himself or herself. To have a printer available for
5037 everybody, you might want to use the built-in IPP client capabilities of Win XP. Add a printer with the print
5038 path of <parameter>http://cupsserver:631/printers/printername</parameter>. We're still looking into this one.
5039 Maybe a logon script could automatically install printers for all users.
5045 <title>Print Change, Notify Functions on NT Clients</title>
5047 <para>For print change, notify functions on NT++ clients. These need to run the <command>Server</command>
5048 service first (renamed to <command>File & Print Sharing for MS Networks</command> in XP).</para>
5053 <title>Win XP-SP1</title>
5055 <para>Win XP-SP1 introduced a Point and Print Restriction Policy (this restriction does not apply to
5056 <quote>Administrator</quote> or <quote>Power User</quote> groups of users). In Group Policy Object Editor, go
5057 to <guimenu>User Configuration -> Administrative Templates -> Control Panel -> Printers</guimenu>. The policy
5058 is automatically set to <constant>Enabled</constant> and the <constant>Users can only Point and Print to
5059 machines in their Forest</constant> . You probably need to change it to <constant>Disabled</constant> or
5060 <constant>Users can only Point and Print to these servers</constant> to make driver downloads from Samba
5066 <title>Print Options for All Users Can't Be Set on Windows 200x/XP</title>
5068 <para>How are you doing it? I bet the wrong way (it is not easy to find out, though). There are three
5069 different ways to bring you to a dialog that <emphasis>seems</emphasis> to set everything. All three dialogs
5070 <emphasis>look</emphasis> the same, yet only one of them does what you intend. You need to be Administrator or
5071 Print Administrator to do this for all users. Here is how I do in on XP:
5074 <orderedlist numeration="upperalpha">
5076 <listitem><para>The first wrong way:
5079 <listitem><para>Open the <guilabel>Printers</guilabel>
5080 folder.</para></listitem>
5082 <listitem><para>Right-click on the printer
5083 (<guilabel>remoteprinter on cupshost</guilabel>) and
5084 select in context menu <guimenuitem>Printing
5085 Preferences...</guimenuitem></para></listitem>.
5087 <listitem><para>Look at this dialog closely and remember what it looks like.</para></listitem>
5091 <listitem><para>The second wrong way:
5093 <listitem><para>Open the <guilabel>Printers</guilabel> folder.</para></listitem>
5095 <listitem><para>Right-click on the printer (<guilabel>remoteprinter on
5096 cupshost</guilabel>) and select the context menu
5097 <guimenuitem>Properties</guimenuitem>.</para></listitem>
5099 <listitem><para>Click on the <guilabel>General</guilabel> tab.</para></listitem>
5101 <listitem><para>Click on the button <guibutton>Printing
5102 Preferences...</guibutton></para></listitem>.
5104 <listitem><para>A new dialog opens. Keep this dialog open and go back
5105 to the parent dialog.</para></listitem>
5109 <listitem><para>The third and correct way:
5111 <listitem><para>Open the <guilabel>Printers</guilabel> folder.</para></listitem>
5113 <listitem><para>Click on the <guilabel>Advanced</guilabel>
5114 tab. (If everything is <quote>grayed out,</quote> then you are not logged
5115 in as a user with enough privileges).</para></listitem>
5117 <listitem><para>Click on the <guibutton>Printing
5118 Defaults...</guibutton> button.</para></listitem>
5120 <listitem><para>On any of the two new tabs, click on the
5121 <guibutton>Advanced...</guibutton> button.</para></listitem>
5123 <listitem><para>A new dialog opens. Compare this one to the other
5124 identical-looking one from step <quote>B.5</quote> or A.3".</para></listitem>
5130 Do you see any difference? I don't either. However, only the last one, which you arrived at with steps
5131 <quote>C.1. to C.6.</quote>, will save any settings permanently and be the defaults for new users. If you want
5132 all clients to get the same defaults, you need to conduct these steps <emphasis>as Administrator</emphasis>
5133 (<smbconfoption name="printer admin"/> in &smb.conf;) <emphasis>before</emphasis> a client downloads the
5134 driver (the clients can later set their own <emphasis>per-user defaults</emphasis> by following the procedures
5135 <emphasis>A</emphasis> or <emphasis>B</emphasis>).
5141 <title>Most Common Blunders in Driver Settings on Windows Clients</title>
5144 Don't use <parameter>Optimize for Speed</parameter>, but use <parameter>Optimize for Portability</parameter>
5145 instead (Adobe PS Driver). Don't use <parameter>Page Independence: No</parameter>. Always settle with
5146 <parameter>Page Independence: Yes</parameter> (Microsoft PS Driver and CUPS PS Driver for Windows NT/200x/XP).
5147 If there are problems with fonts, use <parameter>Download as Softfont into printer</parameter> (Adobe PS
5148 Driver). For <guilabel>TrueType Download Options</guilabel> choose <constant>Outline</constant>. Use
5149 PostScript Level 2 if you are having trouble with a non-PS printer and if there is a choice.
5155 <title><command>cupsaddsmb</command> Does Not Work with Newly Installed Printer</title>
5158 Symptom: The last command of <command>cupsaddsmb</command> does not complete successfully. If the <command>cmd
5159 = setdriver printername printername</command> result was NT_STATUS_UNSUCCESSFUL, then possibly the printer was
5160 not yet recognized by Samba. Did it show up in Network Neighborhood? Did it show up in <command>rpcclient
5161 hostname -c `enumprinters'</command>? Restart smbd (or send a <command>kill -HUP</command> to all processes
5162 listed by <command>smbstatus</command>, and try again.
5166 <title>Permissions on <filename>/var/spool/samba/</filename> Get Reset After Each Reboot</title>
5169 Have you ever by accident set the CUPS spool directory to the same location (<parameter>RequestRoot
5170 /var/spool/samba/</parameter> in <filename>cupsd.conf</filename> or the other way round:
5171 <filename>/var/spool/cups/</filename> is set as <smbconfoption name="path"/>> in the <smbconfsection
5172 name="[printers]"/> section)? These <parameter>must</parameter> be different. Set <parameter>RequestRoot
5173 /var/spool/cups/</parameter> in <filename>cupsd.conf</filename> and <smbconfoption name="path">
5174 /var/spool/samba</smbconfoption> in the <smbconfsection name="[printers]"/> section of &smb.conf;. Otherwise,
5175 cupsd will sanitize permissions to its spool directory with each restart and printing will not work reliably.
5181 <title>Print Queue Called <quote>lp</quote> Mishandles Print Jobs</title>
5184 In this case a print queue called <quote>lp</quote> intermittently swallows jobs and
5185 spits out completely different ones from what was sent.
5189 <indexterm><primary>lp</primary></indexterm>
5190 <indexterm><primary>Implicit Classes</primary></indexterm>
5191 <indexterm><primary>BrowseShortNames</primary></indexterm>
5192 It is a bad idea to name any printer <quote>lp</quote>. This is the traditional UNIX name for the default
5193 printer. CUPS may be set up to do an automatic creation of Implicit Classes. This means, to group all printers
5194 with the same name to a pool of devices and load-balance the jobs across them in a round-robin fashion.
5195 Chances are high that someone else has a printer named <quote>lp</quote> too. You may receive that person's
5196 jobs and send your own to his or her device unwittingly. To have tight control over the printer names, set
5197 <parameter>BrowseShortNames No</parameter>. It will present any printer as
5198 <replaceable>printername@cupshost</replaceable>, which gives you better control over what may happen in a
5199 large networked environment.
5205 <title>Location of Adobe PostScript Driver Files for <quote>cupsaddsmb</quote></title>
5208 Use <command>smbclient</command> to connect to any Windows box with a shared PostScript printer:
5209 <command>smbclient //windowsbox/print\$ -U guest</command>. You can navigate to the
5210 <filename>W32X86/2</filename> subdir to <command>mget ADOBE*</command> and other files or to
5211 <filename>WIN40/0</filename> to do the same. Another option is to download the <filename>*.exe</filename>
5212 packaged files from the Adobe Web site.
5220 <title>Overview of the CUPS Printing Processes</title>
5223 A complete overview of the CUPS printing processes can be found in <link linkend="a_small">the CUPS
5224 Printing Overview diagram</link>.
5227 <figure id="a_small">
5228 <title>CUPS Printing Overview.</title>
5229 <imagefile scale="45">a_small</imagefile>