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 The Common UNIX Print System (<ulink url="http://www.cups.org/">CUPS</ulink>)
38 has become quite popular. All major Linux distributions now ship it as their default printing
39 system. To many, it is still a mystical tool. Mostly, it just works.
40 People tend to regard it as a <quote>black box</quote>
41 that they do not want to look into as long as it works. But once
42 there is a little problem, they are in trouble to find out where to
43 start debugging it. Refer to the chapter <quote>Classical Printing</quote> that
44 contains a lot of information that is relevant for CUPS.
48 CUPS sports quite a few unique and powerful features. While their
49 basic functions may be grasped quite easily, they are also
50 new. Because they are different from other, more traditional printing
51 systems, it is best not to try and apply any prior knowledge about
52 printing to this new system. Rather, try to understand CUPS
53 from the beginning. This documentation will lead you to a
54 complete understanding of CUPS. Let's start with the most basic
61 <title>Overview</title>
64 CUPS is more than just a print spooling system. It is a complete
65 printer management system that complies with the new
66 Internet Printing Protocol (IPP). IPP is an industry
67 and Internet Engineering Task Force (IETF)
68 standard for network printing. Many of its functions can be managed
69 remotely (or locally) via a Web browser (giving you a
70 platform-independent access to the CUPS print server). Additionally, it
71 has the traditional command line and several more modern GUI interfaces
72 (GUI interfaces developed by third parties, like KDE's
73 overwhelming <ulink url="http://printing.kde.org/">KDEPrint</ulink>).
77 CUPS allows creation of <quote>raw</quote> printers (i.e., no print file
78 format translation) as well as <quote>smart</quote> printers (i.e., CUPS does
79 file format conversion as required for the printer). In many ways
80 this gives CUPS similar capabilities to the MS Windows print
81 monitoring system. Of course, if you are a CUPS advocate, you would
82 argue that CUPS is better! In any case, let us now move on to
83 explore how one may configure CUPS for interfacing with MS Windows
84 print clients via Samba.
90 <title>Basic CUPS Support Configuration</title>
93 Printing with CUPS in the most basic &smb.conf; setup in Samba-3.0 (as was true for 2.2.x) only needs two
94 settings: <smbconfoption name="printing">cups</smbconfoption> and
95 <smbconfoption name="printcap">cups</smbconfoption>. CUPS does not need a printcap file.
96 However, the <filename>cupsd.conf</filename> configuration file knows of two related directives that control
97 how such a file will be automatically created and maintained by CUPS for the convenience of third-party
98 applications (example: <parameter>Printcap /etc/printcap</parameter> and <parameter>PrintcapFormat BSD</parameter>).
99 Legacy programs often require the existence of a printcap file containing printer names or they will refuse to
100 print. Make sure CUPS is set to generate and maintain a printcap file. For details, see
101 <command>man cupsd.conf</command> and other CUPS-related documentation, like the wealth of documents on your CUPS server
102 itself: <ulink noescape="1" url="http://localhost:631/documentation.html">http://localhost:631/documentation.html</ulink>.
106 <title>Linking smbd with libcups.so</title>
109 Samba has a special relationship to CUPS. Samba can be compiled with CUPS library support.
110 Most recent installations have this support enabled. Per default, CUPS linking is compiled
111 into smbd and other Samba binaries. Of course, you can use CUPS even
112 if Samba is not linked against <filename>libcups.so</filename> &smbmdash; but
113 there are some differences in required or supported configuration.
117 When Samba is compiled against <filename>libcups</filename>, <smbconfoption name="printcap">cups</smbconfoption>
118 uses the CUPS API to list printers, submit jobs, query queues, and so on. Otherwise it maps to the System V
119 commands with an additional <command>-oraw</command> option for printing. On a Linux
120 system, you can use the <command>ldd</command> utility to find out details (ldd may not be present on
121 other OS platforms, or its function may be embodied by a different command):
125 &rootprompt;<userinput>ldd `which smbd`</userinput>
126 libssl.so.0.9.6 => /usr/lib/libssl.so.0.9.6 (0x4002d000)
127 libcrypto.so.0.9.6 => /usr/lib/libcrypto.so.0.9.6 (0x4005a000)
128 libcups.so.2 => /usr/lib/libcups.so.2 (0x40123000)
133 The line <computeroutput>libcups.so.2 => /usr/lib/libcups.so.2 (0x40123000)</computeroutput> shows
134 there is CUPS support compiled into this version of Samba. If this is the case, and printing = cups
135 is set, then <emphasis>any otherwise manually set print command in &smb.conf; is ignored</emphasis>.
136 This is an important point to remember!
139 <tip><para> Should it be necessary, for any reason, to set your own print commands, you can do this by setting
140 <smbconfoption name="printing">sysv</smbconfoption>. However, you will lose all the benefits
141 of tight CUPS/Samba integration. When you do this you must manually configure the printing system commands
143 <smbconfoption name="print command"/>; other commands are
144 <smbconfoption name="lppause command"/>,
145 <smbconfoption name="lpresume command"/>,
146 <smbconfoption name="lpq command"/>,
147 <smbconfoption name="lprm command"/>,
148 <smbconfoption name="queuepause command"/> and
149 <smbconfoption name="queue resume command"/>).</para></tip>
153 <title>Simple &smb.conf; Settings for CUPS</title>
156 To summarize, <link linkend="cups-exam-simple">following example</link> shows simplest printing-related setup for &smb.conf; to enable basic CUPS support:
159 <para><smbconfexample id="cups-exam-simple">
160 <title>Simplest printing-related smb.conf</title>
161 <smbconfsection name="[global]"/>
162 <smbconfoption name="load printers">yes</smbconfoption>
163 <smbconfoption name="printing">cups</smbconfoption>
164 <smbconfoption name="printcap name">cups</smbconfoption>
166 <smbconfsection name="[printers]"/>
167 <smbconfoption name="comment">All Printers</smbconfoption>
168 <smbconfoption name="path">/var/spool/samba</smbconfoption>
169 <smbconfoption name="browseable">no</smbconfoption>
170 <smbconfoption name="public">yes</smbconfoption>
171 <smbconfoption name="guest ok">yes</smbconfoption>
172 <smbconfoption name="writable">no</smbconfoption>
173 <smbconfoption name="printable">yes</smbconfoption>
174 <smbconfoption name="printer admin">root, @ntadmins</smbconfoption>
176 </smbconfexample></para>
179 This is all you need for basic printing setup for CUPS. It will print
180 all graphic, text, PDF, and PostScript files submitted from Windows
181 clients. However, most of your Windows users would not know how to
182 send these kinds of files to print without opening a GUI
183 application. Windows clients tend to have local printer drivers
184 installed, and the GUI application's print buttons start a printer
185 driver. Your users also rarely send files from the command
186 line. Unlike UNIX clients, they hardly submit graphic, text or PDF
187 formatted files directly to the spooler. They nearly exclusively print
188 from GUI applications with a <quote>printer driver</quote> hooked in between the
189 application's native format and the print-data-stream. If the backend
190 printer is not a PostScript device, the print data stream is <quote>binary,</quote>
191 sensible only for the target printer. Read on to learn which problem
192 this may cause and how to avoid it.
197 <title>More Complex CUPS &smb.conf; Settings</title>
200 <link linkend="overridesettings">Next configuration</link> is a slightly more complex printing-related setup
201 for &smb.conf;. It enables general CUPS printing
202 support for all printers, but defines one printer share, which is set
206 <para><smbconfexample id="overridesettings">
207 <title>Overriding global CUPS settings for one printer</title>
208 <smbconfsection name="[global]"/>
209 <smbconfoption name="printing">cups</smbconfoption>
210 <smbconfoption name="printcap name">cups</smbconfoption>
211 <smbconfoption name="load printers">yes</smbconfoption>
213 <smbconfsection name="[printers]"/>
214 <smbconfoption name="comment">All Printers</smbconfoption>
215 <smbconfoption name="path">/var/spool/samba</smbconfoption>
216 <smbconfoption name="public">yes</smbconfoption>
217 <smbconfoption name="guest ok">yes</smbconfoption>
218 <smbconfoption name="writable">no</smbconfoption>
219 <smbconfoption name="printable">yes</smbconfoption>
220 <smbconfoption name="printer admin">root, @ntadmins</smbconfoption>
222 <smbconfsection name="[special_printer]"/>
223 <smbconfoption name="comment">A special printer with his own settings</smbconfoption>
224 <smbconfoption name="path">/var/spool/samba-special</smbconfoption>
225 <smbconfoption name="printing">sysv</smbconfoption>
226 <smbconfoption name="printcap">lpstat</smbconfoption>
227 <smbconfoption name="print command">echo "NEW: `date`: printfile %f" \</smbconfoption>
228 <member><parameter> >> /tmp/smbprn.log ; \</parameter></member>
229 <member><parameter>echo " `date`: p-%p s-%s f-%f" >> /tmp/smbprn.log ; \</parameter></member>
230 <member><parameter>echo " `date`: j-%j J-%J z-%z c-%c" >> /tmp/smbprn.log ; rm %f</parameter></member>
231 <smbconfoption name="public">no</smbconfoption>
232 <smbconfoption name="guest ok">no</smbconfoption>
233 <smbconfoption name="writable">no</smbconfoption>
234 <smbconfoption name="printable">yes</smbconfoption>
235 <smbconfoption name="printer admin">kurt</smbconfoption>
236 <smbconfoption name="hosts deny">0.0.0.0</smbconfoption>
237 <smbconfoption name="hosts allow">turbo_xp, 10.160.50.23, 10.160.51.60</smbconfoption>
238 </smbconfexample></para>
241 This special share is only there for testing purposes. It does not write the print job to a file. It just logs the job parameters
242 known to Samba into the <filename>/tmp/smbprn.log</filename> file and deletes the job-file. Moreover, the
243 <smbconfoption name="printer admin"/> of this share is <quote>kurt</quote> (not the <quote>@ntadmins</quote> group),
244 guest access is not allowed, the share isn't published to the Network Neighborhood (so you need to know it is there), and it only
245 allows access from only three hosts. To prevent CUPS kicking in and taking over the print jobs for that share, we need to set
246 <smbconfoption name="printing">sysv</smbconfoption> and
247 <smbconfoption name="printcap">lpstat</smbconfoption>.
253 <title>Advanced Configuration</title>
256 Before we delve into all the configuration options, let us clarify a few
257 points. <emphasis>Network printing needs to be organized and setup
258 correctly</emphasis>. This frequently doesn't happen. Legacy systems
259 or small business LAN environments often lack design and good housekeeping.
264 <title>Central Spooling vs. <quote>Peer-to-Peer</quote> Printing</title>
268 <indexterm><primary>spooling</primary><secondary>central</secondary></indexterm>
269 <indexterm><primary>spooling</primary><secondary>peer-to-peer</secondary></indexterm>
270 Many small office or home networks, as well as badly organized larger
271 environments, allow each client a direct access to available network
272 printers. This is generally a bad idea. It often blocks one client's
273 access to the printer when another client's job is printing. It might
274 freeze the first client's application while it is waiting to get
275 rid of the job. Also, there are frequent complaints about various jobs
276 being printed with their pages mixed with each other. A better concept
277 is the usage of a print server: it routes all jobs through one
278 central system, which responds immediately, takes jobs from multiple
279 concurrent clients at the same time, and in turn transfers them to the
280 printer(s) in the correct order.
285 <title>Raw Print Serving &smbmdash; Vendor Drivers on Windows Clients</title>
289 <indexterm><primary>spooling-only</primary></indexterm>
290 <indexterm><primary>"raw" printing</primary></indexterm>
291 Most traditionally configured UNIX print servers acting on behalf of
292 Samba's Windows clients represented a really simple setup. Their only
293 task was to manage the <quote>raw</quote> spooling of all jobs handed to them by
294 Samba. This approach meant that the Windows clients were expected to
295 prepare the print job file that its ready to be sent to the printing
296 device. Here a native (vendor-supplied) Windows printer driver needs to
297 be installed on each and every client for the target device.
301 It is possible to configure CUPS, Samba and your Windows clients in the
302 same traditional and simple way. When CUPS printers are configured
303 for RAW print-through mode operation, it is the responsibility of the
304 Samba client to fully render the print job (file). The file must be
305 sent in a format that is suitable for direct delivery to the
306 printer. Clients need to run the vendor-provided drivers to do
307 this. In this case, CUPS will not do any print file format conversion
312 The easiest printing configuration possible is to use raw print-through.
313 This is achieved by installation of the printer as if it was physically
314 attached to the Windows client. You then redirect output to a raw network
315 print queue. The following procedure may be followed to achieve this:
320 Edit <filename>/etc/cups/mime.types</filename> to uncomment the line
321 near the end of the file that has:
323 #application/octet-...
328 Do the same for the file <filename>/etc/cups/mime.convs</filename>.
332 Add a raw printer using the Web interface. Point your browser at
333 <constant>http://localhost:631</constant>. Enter Administration, add
334 the printer following the prompts. Do not install any drivers for it.
335 Choose Raw. Choose queue name <constant>Raw Queue</constant>.
339 In the &smb.conf; file <constant>[printers]</constant> section add
340 <smbconfoption name="use client driver">Yes</smbconfoption>,
341 and in the <constant>[global]</constant> section add
342 <smbconfoption name="printing">CUPS</smbconfoption>, plus
343 <smbconfoption name="printcap">CUPS</smbconfoption>.
347 Install the printer as if it is a local printer. i.e.: Printing to <constant>LPT1:</constant>.
351 Edit the configuration under the <guimenu>Detail</guimenu> tab, create a
352 <constant>local port</constant> that points to the raw printer queue that
353 you have configured above. Example: <constant>\\server\raw_q</constant>.
354 Here, the name <constant>raw_q</constant> is the name you gave the print
355 queue in the CUPS environment.
362 <title>Installation of Windows Client Drivers</title>
365 The printer drivers on the Windows clients may be installed
366 in two functionally different ways:
370 <listitem><para>Manually install the drivers locally on each client,
371 one by one; this yields the old <emphasis>LanMan</emphasis> style
372 printing and uses a <filename>\\sambaserver\printershare</filename>
373 type of connection.</para></listitem>
377 <indexterm><primary>point 'n' print</primary></indexterm>
378 Deposit and prepare the drivers (for later download) on
379 the print server (Samba); this enables the clients to use
380 <quote>Point'n'Print</quote> to get drivers semi-automatically installed the
381 first time they access the printer; with this method NT/200x/XP
382 clients use the <emphasis>SPOOLSS/MS-RPC</emphasis>
383 type printing calls.</para></listitem>
387 The second method is recommended for use over the first.
391 <sect2 id="cups-raw">
392 <title>Explicitly Enable <quote>raw</quote> Printing for <emphasis>application/octet-stream</emphasis></title>
396 <indexterm><primary>application/octet-stream</primary></indexterm>
397 <indexterm><primary>raw printing</primary></indexterm>
398 <indexterm><primary>MIME</primary><secondary>raw</secondary></indexterm>
399 If you use the first option (drivers are installed on the client
400 side), there is one setting to take care of: CUPS needs to be told
401 that it should allow <quote>raw</quote> printing of deliberate (binary) file
402 formats. The CUPS files that need to be correctly set for RAW mode
403 printers to work are:
407 <listitem><para><filename>/etc/cups/mime.types</filename></para></listitem>
408 <listitem><para><filename>/etc/cups/mime.convs</filename></para></listitem>
412 Both contain entries (at the end of the respective files) which must
413 be uncommented to allow RAW mode operation.
414 In <filename>/etc/cups/mime.types</filename>, make sure this line is
418 application/octet-stream
421 <indexterm><primary>/etc/cups/mime.convs</primary></indexterm>
422 <indexterm><primary>/etc/cups/mime.types</primary></indexterm>
424 In <filename>/etc/cups/mime.convs</filename>,
427 <indexterm><primary>application/vnd.cups-raw</primary></indexterm>
430 application/octet-stream application/vnd.cups-raw 0 -
433 If these two files are not set up correctly for raw Windows client
434 printing, you may encounter the dreaded <computeroutput>Unable to
435 convert file 0</computeroutput> in your CUPS error_log file.
438 <note><para>Editing the <filename>mime.convs</filename> and the
439 <filename>mime.types</filename> file does not
440 <emphasis>enforce</emphasis> <quote>raw</quote> printing, it only
441 <emphasis>allows</emphasis> it.
444 <formalpara><title>Background</title>
448 <indexterm><primary>application/octet-stream</primary></indexterm>
449 CUPS being a more security-aware printing system than traditional ones
450 does not by default allow a user to send deliberate (possibly binary)
451 data to printing devices. This could be easily abused to launch a
452 <quote>Denial of Service</quote> attack on your printer(s), causing at least
453 the loss of a lot of paper and ink. <quote>Unknown</quote> data are tagged by CUPS
454 as <parameter>MIME type: application/octet-stream</parameter> and not
455 allowed to go to the printer. By default, you can only send other
456 (known) MIME types <quote>raw</quote>. Sending data <quote>raw</quote> means that CUPS does not
457 try to convert them and passes them to the printer untouched (see the next
458 chapter for even more background explanations).
463 This is all you need to know to get the CUPS/Samba combo printing
464 <quote>raw</quote> files prepared by Windows clients, which have vendor drivers
465 locally installed. If you are not interested in background information about
466 more advanced CUPS/Samba printing, simply skip the remaining sections
472 <title>Driver Upload Methods</title>
475 This section describes three familiar methods, plus one new one, by which
476 printer drivers may be uploaded.
480 <indexterm><primary>point 'n' print</primary></indexterm>
481 If you want to use the MS-RPC type printing, you must upload the
482 drivers onto the Samba server first (<smbconfsection name="[print$]"/>
483 share). For a discussion on how to deposit printer drivers on the
484 Samba host (so the Windows clients can download and use them via
485 <quote>Point'n'Print</quote>), please refer to the previous chapter of this
486 HOWTO Collection. There you will find a description or reference to
487 three methods of preparing the client drivers on the Samba server:
491 <indexterm><primary>add printer wizard</primary></indexterm>
492 The GUI, <quote>Add Printer Wizard</quote>
493 <emphasis>upload-from-a-Windows-client</emphasis>
494 method.</para></listitem>
496 <listitem><para>The command line, <quote>smbclient/rpcclient</quote>
497 upload-from-a-UNIX-workstation method.</para></listitem>
501 <indexterm><primary>imprints</primary></indexterm>
503 method.</para></listitem>
507 These three methods apply to CUPS all the same. A new and more
508 convenient way to load the Windows drivers into Samba is provided
515 <indexterm><primary>cupsaddsmb</primary></indexterm>
516 the <parameter>cupsaddsmb</parameter>
517 utility.</para></listitem>
521 <command>cupsaddsmb</command> is discussed in much detail further below. But we first
522 explore the CUPS filtering system and compare the Windows and UNIX printing architectures.
528 <title>Advanced Intelligent Printing with PostScript Driver Download</title>
532 <indexterm><primary>PostScript</primary><seealso>Ghostscript</seealso></indexterm>
534 how to set up a <quote>dump</quote> printserver, that is, a server which is spooling
535 print-jobs <quote>raw</quote>, leaving the print data untouched.
539 Possibly you need to setup CUPS in a smarter way. The reasons could
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 setup 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 have 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 about
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 follows 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>
577 <indexterm><primary>GDI</primary></indexterm>
578 <indexterm><primary>PostScript</primary></indexterm>
579 Network printing is one of the most complicated and error-prone
580 day-to-day tasks any user or administrator may encounter. This is
581 true for all OS platforms. And there are reasons for this.
586 <indexterm><primary>PCL</primary></indexterm>
587 <indexterm><primary>PDL</primary></indexterm>
588 You can't expect most file formats to just throw them toward
589 printers and they get printed. There needs to be a file format
590 conversion in between. The problem is that there is no common standard for
591 print file formats across all manufacturers and printer types. While
592 PostScript (trademark held by Adobe) and, to an
593 extent, PCL (trademark held by HP) have developed
594 into semi-official <quote>standards</quote> by being the most widely used PDLs
595 Page Description Languages (PDLs), there are still
596 many manufacturers who <quote>roll their own</quote> (their reasons may be
597 unacceptable license fees for using printer-embedded PostScript
598 interpreters, and so on).
603 <title>Windows Drivers, GDI and EMF</title>
607 <indexterm><primary>GDI</primary></indexterm>
608 <indexterm><primary>EMF</primary></indexterm>
609 <indexterm><primary>WYSIWYG</primary></indexterm>
610 In Windows OS, the format conversion job is done by the printer
611 drivers. On MS Windows OS platforms all application programmers have
612 at their disposal a built-in API, the Graphical Device
613 Interface (GDI), as part and parcel of the OS itself to base
614 themselves on. This GDI core is used as one common unified ground for
615 all Windows programs to draw pictures, fonts and documents
616 <emphasis>on screen</emphasis> as well as <emphasis>on
617 paper</emphasis> (print). Therefore, printer driver developers can
618 standardize on a well-defined GDI output for their own driver
619 input. Achieving WYSIWYG (<quote>What You See Is What You Get</quote>) is
620 relatively easy, because the on-screen graphic primitives, as well as
621 the on-paper drawn objects, come from one common source. This source,
622 the GDI, often produces a file format called Enhanced
623 MetaFile (EMF). The EMF is processed by the printer driver and
624 converted to the printer-specific file format.
628 <indexterm><primary>PDF</primary></indexterm>
629 To the GDI foundation in MS Windows, Apple has chosen to
630 put paper and screen output on a common foundation for their
631 (BSD-UNIX-based, did you know?) Mac OS X and Darwin Operating
632 <indexterm><primary>X Window System</primary></indexterm>
633 <indexterm><primary>PostScript</primary></indexterm>
634 <indexterm><primary>PCL</primary></indexterm>
635 <indexterm><primary>Xprint</primary></indexterm>
636 Systems. Their <emphasis>Core Graphic Engine</emphasis> uses a
637 <emphasis>PDF</emphasis> derivative for all display work.
643 <imagedescription>Windows printing to a local printer.</imagedescription>
644 <imagefile>1small</imagefile>
650 <title>UNIX Printfile Conversion and GUI Basics</title>
654 <indexterm><primary>X Window System</primary></indexterm>
655 <indexterm><primary>PostScript</primary></indexterm>
656 <indexterm><primary>PCL</primary></indexterm>
657 <indexterm><primary>Xprint</primary></indexterm>
658 In UNIX and Linux, there is no comparable layer built into the OS
659 kernel(s) or the X (screen display) server. Every application is
660 responsible for itself to create its print output. Fortunately, most
661 use PostScript and that at least gives some common ground. Unfortunately,
662 there are many different levels of quality for this PostScript. And
663 worse, there is a huge difference (and no common root) in the way
664 the same document is displayed on screen and how it is presented on
665 paper. WYSIWYG is more difficult to achieve. This goes back to the
666 time, decades ago, when the predecessors of X.org,
667 designing the UNIX foundations and protocols for Graphical User
668 Interfaces, refused to take responsibility for <quote>paper output</quote>
669 also, as some had demanded at the time, and restricted itself to
670 <quote>on-screen only.</quote> (For some years now, the <quote>Xprint</quote> project has been
671 under development, attempting to build printing support into the X
672 framework, including a PostScript and a PCL driver, but it is not yet
673 ready for prime time.) You can see this unfavorable inheritance up to
674 the present day by looking into the various <quote>font</quote> directories on your
675 system; there are separate ones for fonts used for X display and fonts
680 <title>Background</title>
684 <indexterm><primary>PostScript</primary></indexterm>
685 The PostScript programming language is an <quote>invention</quote> by Adobe Inc.,
686 but its specifications have been published to the full. Its strength
687 lies in its powerful abilities to describe graphical objects (fonts,
688 shapes, patterns, lines, curves, and dots), their attributes (color,
689 linewidth) and the way to manipulate (scale, distort, rotate,
690 shift) them. Because of its open specification, anybody with the
691 skill can start writing his own implementation of a PostScript
692 interpreter and use it to display PostScript files on screen or on
693 paper. Most graphical output devices are based on the concept of
694 <quote>raster images</quote> or <quote>pixels</quote> (one notable exception is pen
695 plotters). Of course, you can look at a PostScript file in its textual
696 form and you will be reading its PostScript code, the language
697 instructions which need to be interpreted by a rasterizer. Rasterizers
698 produce pixel images, which may be displayed on screen by a viewer
699 program or on paper by a printer.
704 <sect2 id="post-and-ghost">
705 <title>PostScript and Ghostscript</title>
709 <indexterm><primary>PostScript</primary></indexterm>
710 <indexterm><primary>GhostScript</primary><seealso>PostScript</seealso></indexterm>
711 <indexterm><primary>PostScript</primary><secondary>RIP</secondary></indexterm>
712 So, UNIX is lacking a common ground for printing on paper and
713 displaying on screen. Despite this unfavorable legacy for UNIX, basic
714 printing is fairly easy if you have PostScript printers at your
715 disposal. The reason is these devices have a built-in PostScript
716 language <quote>interpreter,</quote> also called a Raster Image
717 Processor (RIP) (which makes them more expensive than
718 other types of printers); throw PostScript toward them, and they will
719 spit out your printed pages. Their RIP is doing all the hard work of
720 converting the PostScript drawing commands into a bitmap picture as
721 you see it on paper, in a resolution as done by your printer. This is
722 no different to PostScript printing a file from a Windows origin.
726 <indexterm><primary>PPD</primary></indexterm>
727 Traditional UNIX programs and printing systems &smbmdash; while
728 using PostScript &smbmdash; are largely not PPD-aware. PPDs are <quote>PostScript
729 Printer Description</quote> files. They enable you to specify and control all
730 options a printer supports: duplexing, stapling and punching. Therefore,
731 UNIX users for a long time couldn't choose many of the supported
732 device and job options, unlike Windows or Apple users. But now there
739 <imagedescription>Printing to a PostScript printer.</imagedescription>
740 <imagefile>2small</imagefile>
746 <indexterm><primary>PDL</primary></indexterm>
747 However, there are other types of printers out there. These do not know
748 how to print PostScript. They use their own Page Description
749 Language (PDL, often proprietary). To print to them is much
750 more demanding. Since your UNIX applications mostly produce
751 PostScript, and since these devices do not understand PostScript, you
752 need to convert the print files to a format suitable for your printer
753 on the host before you can send it away.
758 <title>Ghostscript &smbmdash; the Software RIP for Non-PostScript Printers</title>
762 <indexterm><primary>GhostScript</primary></indexterm>
763 Here is where Ghostscript kicks in. Ghostscript is
764 the traditional (and quite powerful) PostScript interpreter used on
765 UNIX platforms. It is a RIP in software, capable of doing a
766 <emphasis>lot</emphasis> of file format conversions for a very broad
767 spectrum of hardware devices as well as software file formats.
768 Ghostscript technology and drivers are what enable PostScript printing
769 to non-PostScript hardware.
773 <image><imagedescription>Ghostscript as a RIP for non-postscript printers.</imagedescription>
774 <imagefile>3small</imagefile>
779 Use the <quote>gs -h</quote> command to check for all built-in <quote>devices</quote>
780 of your Ghostscript version. If you specify a parameter of
781 <parameter>-sDEVICE=png256</parameter> on your Ghostscript command
782 line, you are asking Ghostscript to convert the input into a PNG
783 file. Naming a <quote>device</quote> on the command line is the most important
784 single parameter to tell Ghostscript exactly how it should render the
785 input. New Ghostscript versions are released at fairly regular
786 intervals, now by artofcode LLC. They are initially put under the
787 <quote>AFPL</quote> license, but re-released under the GNU GPL as soon as the next
788 AFPL version appears. GNU Ghostscript is probably the version
789 installed on most Samba systems. But it has some deficiencies.
790 <indexterm><primary>Ghostscript</primary><secondary>ESP</secondary><see>ESP GhostScript</see></indexterm>
791 Therefore, ESP Ghostscript was developed as an
792 enhancement over GNU Ghostscript, with lots of bug-fixes, additional
793 devices and improvements. It is jointly maintained by developers from
794 CUPS, Gimp-Print, MandrakeSoft, SuSE, Red Hat, and Debian. It includes
795 the <quote>cups</quote> device (essential to print to non-PS printers from CUPS).
800 <title>PostScript Printer Description (PPD) Specification</title>
804 <indexterm><primary>PPD</primary></indexterm>
805 While PostScript in essence is a Page Description
806 Language (PDL) to represent the page layout in a
807 device-independent way, real-world print jobs are
808 always ending up being output on hardware with device-specific
809 features. To take care of all the differences in hardware and to
810 allow for innovations, Adobe has specified a syntax and file format
811 for PostScript Printer Description (PPD)
812 files. Every PostScript printer ships with one of these files.
816 PPDs contain all the information about general and special features of the
817 given printer model: Which different resolutions can it handle? Does
818 it have a Duplexing Unit? How many paper trays are there? What media
819 types and sizes does it take? For each item, it also names the special
820 command string to be sent to the printer (mostly inside the PostScript
821 file) in order to enable it.
825 Information from these PPDs is meant to be taken into account by the
826 printer drivers. Therefore, installed as part of the Windows
827 PostScript driver for a given printer is the printer's PPD. Where it
828 makes sense, the PPD features are presented in the drivers' UI dialogs
829 to display to the user a choice of print options. In the end, the
830 user selections are somehow written (in the form of special
831 PostScript, PJL, JCL or vendor-dependent commands) into the PostScript
832 file created by the driver.
836 <indexterm><primary>PDF</primary></indexterm>
837 A PostScript file that was created to contain device-specific commands
838 for achieving a certain print job output (e.g., duplex-ed, stapled and
839 punched) on a specific target machine, may not print as expected, or
840 may not be printable at all on other models; it also may not be fit
841 for further processing by software (e.g., by a PDF distilling program).
846 <title>Using Windows-Formatted Vendor PPDs</title>
849 CUPS can handle all spec-compliant PPDs as supplied by the
850 manufacturers for their PostScript models. Even if a
851 vendor might not have mentioned our favorite
852 OS in his manuals and brochures, you can safely trust this:
853 <emphasis>If you get the Windows NT version of the PPD, you
854 can use it unchanged in CUPS</emphasis> and thus access the full
855 power of your printer just like a Windows NT user could!
859 To check the spec compliance of any PPD online, go to <ulink
860 noescape="1" url="http://www.cups.org/testppd.php">http://www.cups.org/testppd.php</ulink>
861 and upload your PPD. You will see the results displayed
862 immediately. CUPS in all versions after 1.1.19 has a much more strict
863 internal PPD parsing and checking code enabled; in case of printing
864 trouble, this online resource should be one of your first pit-stops.
868 <indexterm><primary>foomatic</primary></indexterm>
869 <indexterm><primary>cupsomatic</primary></indexterm>
870 For real PostScript printers, <emphasis>do not</emphasis> use the
871 <emphasis>Foomatic</emphasis> or <emphasis>cupsomatic</emphasis>
872 PPDs from Linuxprinting.org. With these devices, the original
873 vendor-provided PPDs are always the first choice!
877 If you are looking for an original vendor-provided PPD of a specific
878 device, and you know that an NT4 box (or any other Windows box) on
879 your LAN has the PostScript driver installed, just use
880 <command>smbclient //NT4-box/print\$ -U username</command> to
881 access the Windows directory where all printer driver files are
882 stored. First look in the <filename>W32X86/2</filename> subdir for
883 the PPD you are seeking.
888 <title>CUPS Also Uses PPDs for Non-PostScript Printers</title>
891 CUPS also uses specially crafted PPDs to handle non-PostScript
892 printers. These PPDs are usually not available from the vendors (and
893 no, you can't just take the PPD of a PostScript printer with the same
894 model name and hope it works for the non-PostScript version too). To
895 understand how these PPDs work for non-PS printers, we first need to
896 dive deeply into the CUPS filtering and file format conversion
897 architecture. Stay tuned.
903 <title>The CUPS Filtering Architecture</title>
906 The core of the CUPS filtering system is based on
907 Ghostscript. In addition to Ghostscript, CUPS
908 uses some other filters of its own. You (or your OS vendor) may have
909 plugged in even more filters. CUPS handles all data file formats under
910 the label of various MIME types. Every incoming
911 printfile is subjected to an initial
912 auto-typing. The auto-typing determines its given
913 MIME type. A given MIME type implies zero or more possible filtering
914 chains relevant to the selected target printer. This section discusses
915 how MIME types recognition and conversion rules interact. They are
916 used by CUPS to automatically setup a working filtering chain for any
917 given input data format.
921 If CUPS rasterizes a PostScript file natively to
922 a bitmap, this is done in two stages:
926 <listitem><para>The first stage uses a Ghostscript device named <quote>cups</quote>
927 (this is since version 1.1.15) and produces a generic raster format
928 called <quote>CUPS raster</quote>.
931 <listitem><para>The second stage uses a <quote>raster driver</quote> that converts
932 the generic CUPS raster to a device-specific raster.</para></listitem>
936 Make sure your Ghostscript version has the <quote>cups</quote> device compiled in
937 (check with <command>gs -h | grep cups</command>). Otherwise you
938 may encounter the dreaded <computeroutput>Unable to convert file
939 0</computeroutput> in your CUPS error_log file. To have <quote>cups</quote> as a
940 device in your Ghostscript, you either need to patch GNU
941 Ghostscript and re-compile, or use <indexterm><primary>ESP</primary><secondary>Ghostscript</secondary></indexterm><ulink
942 url="http://www.cups.org/ghostscript.php">ESP Ghostscript</ulink>. The
943 superior alternative is ESP Ghostscript. It supports not just CUPS,
944 but 300 other devices too (while GNU Ghostscript supports only about
945 180). Because of this broad output device support, ESP Ghostscript is
946 the first choice for non-CUPS spoolers, too. It is now recommended by
947 Linuxprinting.org for all spoolers.
951 <indexterm><primary>cupsomatic</primary></indexterm>
952 <indexterm><primary>foomatic</primary></indexterm>
953 CUPS printers may be setup to use external rendering paths. One of the most common is provided by the
954 Foomatic/cupsomatic concept from <ulink url="http://www.linuxprinting.org/">Linuxprinting.org.</ulink> This
955 uses the classical Ghostscript approach, doing everything in one step.
956 It does not use the <quote>cups</quote> device, but one of the many
957 others. However, even for Foomatic/cupsomatic usage, best results and
958 <indexterm><primary>ESP</primary><secondary>Ghostscript</secondary></indexterm>
959 broadest printer model support is provided by ESP Ghostscript (more
960 about cupsomatic/Foomatic, particularly the new version called now
961 <emphasis>foomatic-rip</emphasis>, follows below).
965 <title>MIME Types and CUPS Filters</title>
969 <indexterm><primary>MIME</primary><secondary>filters</secondary></indexterm>
970 <indexterm><primary>MIME</primary></indexterm>
971 CUPS reads the file <filename>/etc/cups/mime.types</filename>
972 (and all other files carrying a <filename>*.types</filename> suffix
973 in the same directory) upon startup. These files contain the MIME
974 type recognition rules that are applied when CUPS runs its
975 auto-typing routines. The rule syntax is explained in the man page
976 for <filename>mime.types</filename> and in the comments section of the
977 <filename>mime.types</filename> file itself. A simple rule reads
980 <indexterm><primary>application/pdf</primary></indexterm>
982 application/pdf pdf string(0,%PDF)
985 This means if a filename has either a
986 <filename>.pdf</filename> suffix or if the magic
987 string <emphasis>%PDF</emphasis> is right at the
988 beginning of the file itself (offset 0 from the start), then it is
989 a PDF file (<parameter>application/pdf</parameter>).
990 Another rule is this:
993 application/postscript ai eps ps string(0,%!) string(0,<04>%!)
996 If the filename has one of the suffixes
997 <filename>.ai</filename>, <filename>.eps</filename>,
998 <filename>.ps</filename> or if the file itself starts with one of the
999 strings <emphasis>%!</emphasis> or <emphasis><![CDATA[<04>%!]]></emphasis>, it
1000 is a generic PostScript file
1001 (<parameter>application/postscript</parameter>).
1005 Don't confuse the other mime.types files your system might be using
1006 with the one in the <filename>/etc/cups/</filename> directory.
1010 There is an important difference between two similar MIME types in
1011 CUPS: one is <parameter>application/postscript</parameter>, the other is
1012 <parameter>application/vnd.cups-postscript</parameter>. While
1013 <parameter>application/postscript</parameter> is meant to be device
1014 independent (job options for the file are still outside the PS file
1015 content, embedded in command line or environment variables by CUPS),
1016 <parameter>application/vnd.cups-postscript</parameter> may have the job
1017 options inserted into the PostScript data itself (where
1018 applicable). The transformation of the generic PostScript
1019 (<parameter>application/postscript</parameter>) to the device-specific version
1020 (<parameter>application/vnd.cups-postscript</parameter>) is the responsibility of the
1021 CUPS <parameter>pstops</parameter> filter. pstops uses information
1022 contained in the PPD to do the transformation.
1026 CUPS can handle ASCII text, HP-GL, PDF, PostScript, DVI, and
1027 many image formats (GIF. PNG, TIFF, JPEG, Photo-CD, SUN-Raster,
1028 PNM, PBM, SGI-RGB, and more) and their associated MIME types
1034 <title>MIME Type Conversion Rules</title>
1038 <indexterm><primary>MIME</primary></indexterm>
1039 <indexterm><primary>application/pdf</primary></indexterm>
1040 CUPS reads the file <filename>/etc/cups/mime.convs</filename>
1041 (and all other files named with a <filename>*.convs</filename>
1042 suffix in the same directory) upon startup. These files contain
1043 lines naming an input MIME type, an output MIME type, a format
1044 conversion filter that can produce the output from the input type
1045 and virtual costs associated with this conversion. One example line
1049 application/pdf application/postscript 33 pdftops
1052 This means that the <parameter>pdftops</parameter> filter will take
1053 <parameter>application/pdf</parameter> as input and produce
1054 <parameter>application/postscript</parameter> as output; the virtual
1055 cost of this operation is 33 CUPS-$. The next filter is more
1056 expensive, costing 66 CUPS-$:
1058 <indexterm><primary>pdf</primary></indexterm>
1061 application/vnd.hp-HPGL application/postscript 66 hpgltops
1064 This is the <parameter>hpgltops</parameter>, which processes HP-GL
1065 plotter files to PostScript.
1067 <indexterm><primary>application/octet-stream</primary></indexterm>
1070 application/octet-stream
1073 Here are two more examples:
1075 <indexterm><primary>text/plain</primary></indexterm>
1078 application/x-shell application/postscript 33 texttops
1079 text/plain application/postscript 33 texttops
1082 The last two examples name the <parameter>texttops</parameter> filter
1083 to work on <parameter>text/plain</parameter> as well as on <parameter>application/x-shell</parameter>. (Hint:
1084 This differentiation is needed for the syntax highlighting feature of
1085 <parameter>texttops</parameter>).
1090 <title>Filtering Overview</title>
1094 <indexterm><primary>MIME</primary></indexterm>
1095 There are many more combinations named in <filename>mime.convs</filename>. However, you
1096 are not limited to use the ones pre-defined there. You can plug in any
1097 filter you like into the CUPS framework. It must meet, or must be made
1098 to meet, some minimal requirements. If you find (or write) a cool
1099 conversion filter of some kind, make sure it complies to what CUPS
1100 needs and put in the right lines in <filename>mime.types</filename>
1101 and <filename>mime.convs</filename>, then it will work seamlessly
1106 <title>Filter requirements</title>
1108 The mentioned <quote>CUPS requirements</quote> for filters are simple. Take
1109 filenames or <filename>stdin</filename> as input and write to
1110 <filename>stdout</filename>. They should take these 5 or 6 arguments:
1111 <emphasis>printer job user title copies options [filename]</emphasis>
1115 <varlistentry><term>Printer </term>
1116 <listitem><para>The name of the printer queue (normally this is the
1117 name of the filter being run).</para></listitem>
1120 <varlistentry><term>job </term>
1121 <listitem><para>The numeric job ID for the job being
1122 printed.</para></listitem>
1125 <varlistentry><term>user </term>
1126 <listitem><para>The string from the originating-user-name
1127 attribute.</para></listitem>
1130 <varlistentry><term>title </term>
1131 <listitem><para>The string from the job-name attribute.</para></listitem>
1134 <varlistentry><term>copies </term>
1135 <listitem><para>The numeric value from the number-copies
1136 attribute.</para></listitem>
1139 <varlistentry><term>options </term>
1140 <listitem><para>The job options.</para></listitem>
1143 <varlistentry><term>filename </term>
1144 <listitem><para>(Optionally) The print request file (if missing,
1145 filters expected data fed through <filename>stdin</filename>). In most
1146 cases, it is easy to write a simple wrapper script around existing
1147 filters to make them work with CUPS.</para></listitem>
1154 <title>Prefilters</title>
1158 <indexterm><primary>PostScript</primary></indexterm>
1159 As previously stated, PostScript is the central file format to any UNIX-based
1160 printing system. From PostScript, CUPS generates raster data to feed
1161 non-PostScript printers.
1165 But what happens if you send one of the supported non-PS formats
1166 to print? Then CUPS runs <quote>pre-filters</quote> on these input formats to
1167 generate PostScript first. There are pre-filters to create PS from
1168 ASCII text, PDF, DVI, or HP-GL. The outcome of these filters is always
1169 of MIME type <parameter>application/postscript</parameter> (meaning that
1170 any device-specific print options are not yet embedded into the
1171 PostScript by CUPS, and that the next filter to be called is
1172 pstops). Another pre-filter is running on all supported image formats,
1173 the <parameter>imagetops</parameter> filter. Its outcome is always of
1174 MIME type <parameter>application/vnd.cups-postscript</parameter>
1175 (not application/postscript), meaning it has the
1176 print options already embedded into the file.
1181 <imagedescription>Pre-filtering in CUPS to form PostScript.</imagedescription>
1182 <imagefile scale="25">4small</imagefile>
1188 <title>pstops</title>
1191 <emphasis>pstops</emphasis> is the filter to convert
1192 <parameter>application/postscript</parameter> to <?latex \linebreak ?>
1193 <parameter>application/vnd.cups-postscript</parameter>. It was said
1194 above that this filter inserts all device-specific print options
1195 (commands to the printer to ask for the duplexing of output, or
1196 stapling and punching it, and so on) into the PostScript file.
1200 <image><imagedescription>Adding device-specific print options.</imagedescription>
1201 <imagefile scale="25">5small</imagefile>
1206 This is not all. Other tasks performed by it are:
1211 Selecting the range of pages to be printed (if you choose to
1212 print only pages <quote>3, 6, 8-11, 16, 19-21</quote>, or only the odd numbered
1217 Putting 2 or more logical pages on one sheet of paper (the
1218 so-called <quote>number-up</quote> function).
1221 <listitem><para>Counting the pages of the job to insert the accounting
1222 information into the <filename>/var/log/cups/page_log</filename>.
1228 <title>pstoraster</title>
1231 <parameter>pstoraster</parameter> is at the core of the CUPS filtering
1232 system. It is responsible for the first stage of the rasterization
1233 process. Its input is of MIME type application/vnd.cups-postscript;
1234 its output is application/vnd.cups-raster. This output format is not
1235 yet meant to be printable. Its aim is to serve as a general purpose
1236 input format for more specialized <emphasis>raster drivers</emphasis>
1237 that are able to generate device-specific printer data.
1242 <imagedescription>PostScript to intermediate raster format.</imagedescription>
1243 <imagefile scale="25">6small</imagefile>
1248 CUPS raster is a generic raster format with powerful features. It is
1249 able to include per-page information, color profiles, and more, to be
1250 used by the following downstream raster drivers. Its MIME type is
1251 registered with IANA and its specification is, of course, completely
1252 open. It is designed to make it quite easy and inexpensive for
1253 manufacturers to develop Linux and UNIX raster drivers for their
1254 printer models, should they choose to do so. CUPS always takes care
1255 for the first stage of rasterization so these vendors do not need to care
1256 about Ghostscript complications (in fact, there is currently more
1257 than one vendor financing the development of CUPS raster drivers).
1262 <imagedescription>CUPS-raster production using Ghostscript.</imagedescription>
1263 <imagefile>7small</imagefile>
1268 CUPS versions before version 1.1.15 were shipping a binary (or source
1269 code) standalone filter, named <parameter>pstoraster</parameter>. <parameter>pstoraster</parameter> was derived
1270 from GNU Ghostscript 5.50, and could be installed besides and in
1271 addition to any GNU or AFPL Ghostscript package without conflicting.
1275 >From version 1.1.15, this has changed. The functions for this have been
1276 integrated back into Ghostscript (now based on GNU Ghostscript version
1277 7.05). The <parameter>pstoraster</parameter> filter is now a simple shell script calling
1278 <command>gs</command> with the <command>-sDEVICE=cups</command>
1279 parameter. If your Ghostscript does not show a success on asking for
1280 <command>gs -h |grep cups</command>, you might not be able to
1281 print. Update your Ghostscript.
1286 <title>imagetops and imagetoraster</title>
1289 In the section about pre-filters, we mentioned the pre-filter
1290 that generates PostScript from image formats. The <parameter>imagetoraster</parameter>
1291 filter is used to convert directly from image to raster, without the
1292 intermediate PostScript stage. It is used more often than the above
1293 mentioned pre-filters. We summarize flowchart of image file
1294 filtering on <link linkend="small8">next picture</link>.
1299 <imagedescription>Image format to CUPS-raster format conversion.</imagedescription>
1300 <imagefile>8small</imagefile>
1307 <title>rasterto [printers specific]</title>
1310 CUPS ships with quite different raster drivers processing CUPS
1311 raster. On my system I find in /usr/lib/cups/filter/ these:
1312 <parameter>rastertoalps</parameter>, <parameter>rastertobj</parameter>, <parameter>rastertoepson</parameter>, <parameter>rastertoescp</parameter>,
1313 <parameter>rastertopcl</parameter>, <parameter>rastertoturboprint</parameter>, <parameter>rastertoapdk</parameter>, <parameter>rastertodymo</parameter>,
1314 <parameter>rastertoescp</parameter>, <parameter>rastertohp</parameter>, and
1315 <parameter>rastertoprinter</parameter>. Don't worry if you have less
1316 than this; some of these are installed by commercial add-ons to CUPS
1317 (like <parameter>rastertoturboprint</parameter>), others (like
1318 <parameter>rastertoprinter</parameter>) by third-party driver
1319 development projects (such as Gimp-Print) wanting to cooperate as
1320 closely as possible with CUPS.
1325 <imagedescription>Raster to printer-specific formats.</imagedescription>
1326 <imagefile>9small</imagefile>
1332 <title>CUPS Backends</title>
1335 The last part of any CUPS filtering chain is a backend. Backends
1336 are special programs that send the print-ready file to the final
1337 device. There is a separate backend program for any transfer
1338 protocol of sending print jobs over the network, or for every local
1339 interface. Every CUPS print queue needs to have a CUPS <quote>device-URI</quote>
1340 associated with it. The device URI is the way to encode the backend
1341 used to send the job to its destination. Network device-URIs are using
1342 two slashes in their syntax, local device URIs only one, as you can
1343 see from the following list. Keep in mind that local interface names
1344 may vary much from my examples, if your OS is not Linux:
1348 <varlistentry><term>usb </term>
1350 This backend sends print files to USB-connected printers. An
1351 example for the CUPS device-URI to use is:
1352 <filename>usb:/dev/usb/lp0</filename>.
1353 </para></listitem></varlistentry>
1355 <varlistentry><term>serial </term>
1357 This backend sends print files to serially connected printers.
1358 An example for the CUPS device-URI to use is:
1359 <filename>serial:/dev/ttyS0?baud=11500</filename>.
1360 </para></listitem></varlistentry>
1362 <varlistentry><term>parallel </term>
1364 This backend sends print files to printers connected to the
1365 parallel port. An example for the CUPS device-URI to use is:
1366 <filename>parallel:/dev/lp0</filename>.
1367 </para></listitem></varlistentry>
1369 <varlistentry><term>SCSI </term>
1371 This backend sends print files to printers attached to the
1372 SCSI interface. An example for the CUPS device-URI to use is:
1373 <filename>scsi:/dev/sr1</filename>.
1374 </para></listitem></varlistentry>
1376 <varlistentry><term>lpd </term>
1378 This backend sends print files to LPR/LPD connected network
1379 printers. An example for the CUPS device-URI to use is:
1380 <filename>lpd://remote_host_name/remote_queue_name</filename>.
1381 </para></listitem></varlistentry>
1383 <varlistentry><term>AppSocket/HP JetDirect </term>
1385 This backend sends print files to AppSocket (a.k.a. "HP
1386 JetDirect") connected network printers. An example for the CUPS
1387 device-URI to use is:
1388 <filename>socket://10.11.12.13:9100</filename>.
1389 </para></listitem></varlistentry>
1391 <varlistentry><term>ipp </term>
1393 This backend sends print files to IPP connected network
1394 printers (or to other CUPS servers). Examples for CUPS device-URIs
1396 <filename>ipp:://192.193.194.195/ipp</filename>
1397 (for many HP printers) or
1398 <filename>ipp://remote_cups_server/printers/remote_printer_name</filename>.
1399 </para></listitem></varlistentry>
1401 <varlistentry><term>http </term>
1403 This backend sends print files to HTTP connected printers.
1404 (The http:// CUPS backend is only a symlink to the ipp:// backend.)
1405 Examples for the CUPS device-URIs to use are:
1406 <filename>http:://192.193.194.195:631/ipp</filename>
1407 (for many HP printers) or
1408 <filename>http://remote_cups_server:631/printers/remote_printer_name</filename>.
1409 </para></listitem></varlistentry>
1411 <varlistentry><term>smb </term>
1413 This backend sends print files to printers shared by a Windows
1414 host. An example for CUPS device-URIs that may be used includes:
1419 <member><filename>smb://workgroup/server/printersharename</filename></member>
1420 <member><filename>smb://server/printersharename</filename></member>
1421 <member><filename>smb://username:password@workgroup/server/printersharename</filename></member>
1422 <member><filename>smb://username:password@server/printersharename</filename></member>
1427 The smb:// backend is a symlink to the Samba utility
1428 <parameter>smbspool</parameter> (does not ship with CUPS). If the
1429 symlink is not present in your CUPS backend directory, have your
1430 root user create it: <command>ln -s `which smbspool'
1431 /usr/lib/cups/backend/smb</command>.
1432 </para></listitem></varlistentry>
1436 It is easy to write your own backends as shell or Perl scripts, if you
1437 need any modification or extension to the CUPS print system. One
1438 reason could be that you want to create <quote>special</quote> printers that send
1439 the print-jobs as email (through a <quote>mailto:/</quote> backend), convert them to
1440 PDF (through a <quote>pdfgen:/</quote> backend) or dump them to <quote>/dev/null</quote>. (In
1441 fact I have the system-wide default printer set up to be connected to
1442 a devnull:/ backend: there are just too many people sending jobs
1443 without specifying a printer, or scripts and programs which do not name
1444 a printer. The system-wide default deletes the job and sends a polite
1445 email back to the $USER asking him to always specify the correct
1450 Not all of the mentioned backends may be present on your system or
1451 usable (depending on your hardware configuration). One test for all
1452 available CUPS backends is provided by the <emphasis>lpinfo</emphasis>
1453 utility. Used with the <option>-v</option> parameter, it lists
1454 all available backends:
1458 &prompt;<userinput>lpinfo -v</userinput>
1463 <title>The Role of <parameter>cupsomatic/foomatic</parameter></title>
1466 <indexterm><primary>cupsomatic</primary></indexterm>
1467 <indexterm><primary>foomatic</primary></indexterm>
1468 <parameter>cupsomatic</parameter> filters may be the most widely used on CUPS
1469 installations. You must be clear about the fact that these were not
1470 developed by the CUPS people. They are a third party add-on to
1471 CUPS. They utilize the traditional Ghostscript devices to render jobs
1472 for CUPS. When troubleshooting, you should know about the
1473 difference. Here the whole rendering process is done in one stage,
1474 inside Ghostscript, using an appropriate device for the target
1475 printer. <parameter>cupsomatic</parameter> uses PPDs that are generated from the Foomatic
1476 Printer & Driver Database at Linuxprinting.org.
1480 You can recognize these PPDs from the line calling the
1481 <parameter>cupsomatic</parameter> filter:
1484 *cupsFilter: "application/vnd.cups-postscript 0 cupsomatic"
1487 You may find this line among the first 40 or so lines of the PPD
1488 file. If you have such a PPD installed, the printer shows up in the
1489 CUPS Web interface with a <parameter>foomatic</parameter> namepart for
1490 the driver description. <parameter>cupsomatic</parameter> is a Perl script that runs
1491 Ghostscript with all the complicated command line options
1492 auto-constructed from the selected PPD and command line options give to
1497 <indexterm><primary>point 'n' print</primary></indexterm>
1498 However, <parameter>cupsomatic</parameter> is now deprecated. Its PPDs (especially the first
1499 generation of them, still in heavy use out there) are not meeting the
1500 Adobe specifications. You might also suffer difficulties when you try
1501 to download them with <quote>Point'n'Print</quote> to Windows clients. A better
1502 and more powerful successor is now in a stable beta-version: it is called <parameter>foomatic-rip</parameter>. To use
1503 <parameter>foomatic-rip</parameter> as a filter with CUPS, you need the new-type PPDs. These
1504 have a similar but different line:
1507 *cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
1510 The PPD generating engine at Linuxprinting.org has been revamped.
1511 The new PPDs comply to the Adobe spec. On top, they also provide a
1512 new way to specify different quality levels (hi-res photo, normal
1513 color, grayscale, and draft) with a single click, whereas before you
1514 could have required five or more different selections (media type,
1515 resolution, inktype and dithering algorithm). There is support for
1516 custom-size media built in. There is support to switch
1517 print-options from page to page in the middle of a job. And the
1518 best thing is the new foomatic-rip now works seamlessly with all
1519 legacy spoolers too (like LPRng, BSD-LPD, PDQ, PPR and so on), providing
1520 for them access to use PPDs for their printing.
1525 <title>The Complete Picture</title>
1528 If you want to see an overview of all the filters and how they
1529 relate to each other, the complete picture of the puzzle is at the end
1535 <title><filename>mime.convs</filename></title>
1538 CUPS auto-constructs all possible filtering chain paths for any given
1539 MIME type, and every printer installed. But how does it decide in
1540 favor or against a specific alternative? (There may often be cases
1541 where there is a choice of two or more possible filtering chains for
1542 the same target printer.) Simple. You may have noticed the figures in
1543 the third column of the mime.convs file. They represent virtual costs
1544 assigned to this filter. Every possible filtering chain will sum up to
1545 a total <quote>filter cost.</quote> CUPS decides for the most <quote>inexpensive</quote> route.
1549 The setting of <parameter>FilterLimit 1000</parameter> in
1550 <filename>cupsd.conf</filename> will not allow more filters to
1551 run concurrently than will consume a total of 1000 virtual filter
1552 cost. This is an efficient way to limit the load of any CUPS
1553 server by setting an appropriate <quote>FilterLimit</quote> value. A FilterLimit of
1554 200 allows roughly one job at a time, while a FilterLimit of 1000 allows
1555 approximately five jobs maximum at a time.
1560 <title><quote>Raw</quote> Printing</title>
1563 You can tell CUPS to print (nearly) any file <quote>raw</quote>. <quote>Raw</quote> means it
1564 will not be filtered. CUPS will send the file to the printer <quote>as is</quote>
1565 without bothering if the printer is able to digest it. Users need to
1566 take care themselves that they send sensible data formats only. Raw
1567 printing can happen on any queue if the <quote><parameter>-o raw</parameter></quote> option is specified
1568 on the command line. You can also set up raw-only queues by simply not
1569 associating any PPD with it. This command:
1573 &prompt;<userinput>lpadmin -P rawprinter -v socket://11.12.13.14:9100 -E</userinput>
1577 sets up a queue named <quote>rawprinter</quote>, connected via the <quote>socket</quote>
1578 protocol (a.k.a. <quote>HP JetDirect</quote>) to the device at IP address
1579 11.12.1.3.14, using port 9100. (If you had added a PPD with
1580 <command>-P /path/to/PPD</command> to this command line, you would
1581 have installed a <quote>normal</quote> print queue.
1585 CUPS will automatically treat each job sent to a queue as a <quote>raw</quote> one,
1586 if it can't find a PPD associated with the queue. However, CUPS will
1587 only send known MIME types (as defined in its own mime.types file) and
1593 <title>application/octet-stream Printing</title>
1596 Any MIME type with no rule in the
1597 <filename>/etc/cups/mime.types</filename> file is regarded as unknown
1598 or <parameter>application/octet-stream</parameter> and will not be
1599 sent. Because CUPS refuses to print unknown MIME types per default,
1600 you will probably have experienced the fact that print jobs originating
1601 from Windows clients were not printed. You may have found an error
1602 message in your CUPS logs like:
1605 <para><computeroutput>
1606 Unable to convert file 0 to printable format for job
1607 </computeroutput></para>
1610 To enable the printing of <parameter>application/octet-stream</parameter> files, edit
1615 <listitem><para><filename>/etc/cups/mime.convs</filename></para></listitem>
1617 <listitem><para><filename>/etc/cups/mime.types</filename></para></listitem>
1621 Both contain entries (at the end of the respective files) which must
1622 be uncommented to allow RAW mode operation for
1623 <parameter>application/octet-stream</parameter>. In <filename>/etc/cups/mime.types</filename>
1624 make sure this line is present:
1626 <indexterm><primary>application/octet-stream</primary></indexterm>
1629 application/octet-stream
1632 This line (with no specific auto-typing rule set) makes all files
1633 not otherwise auto-typed a member of <parameter>application/octet-stream</parameter>. In
1634 <filename>/etc/cups/mime.convs</filename>, have this
1638 application/octet-stream application/vnd.cups-raw 0 -
1641 <indexterm><primary>MIME</primary></indexterm>
1643 This line tells CUPS to use the <emphasis>Null Filter</emphasis>
1644 (denoted as <quote>-</quote>, doing nothing at all) on
1645 <parameter>application/octet-stream</parameter>, and tag the result as
1646 <parameter>application/vnd.cups-raw</parameter>. This last one is
1647 always a green light to the CUPS scheduler to now hand the file over
1648 to the backend connecting to the printer and sending it over.
1651 <note><para>Editing the <filename>mime.convs</filename> and the
1652 <filename>mime.types</filename> file does not
1653 <emphasis>enforce</emphasis> <quote>raw</quote> printing, it only
1654 <emphasis>allows</emphasis> it.
1658 <title>Background</title>
1661 CUPS being a more security-aware printing system than traditional ones
1662 does not by default allow one to send deliberate (possibly binary)
1663 data to printing devices. (This could be easily abused to launch a
1664 Denial of Service attack on your printer(s), causing at least the loss
1665 of a lot of paper and ink...) <quote>Unknown</quote> data are regarded by CUPS
1666 as <emphasis>MIME type</emphasis>
1667 <emphasis>application/octet-stream</emphasis>. While you
1668 <emphasis>can</emphasis> send data <quote>raw</quote>, the MIME type for these must
1669 be one that is known to CUPS and an allowed one. The file
1670 <filename>/etc/cups/mime.types</filename> defines the <quote>rules</quote> of how CUPS
1671 recognizes MIME types. The file
1672 <filename>/etc/cups/mime.convs</filename> decides which file
1673 conversion filter(s) may be applied to which MIME types.
1679 <title>PostScript Printer Descriptions (PPDs) for Non-PS Printers</title>
1683 <indexterm><primary>PPD</primary></indexterm>
1684 Originally PPDs were meant to be used for PostScript printers
1685 only. Here, they help to send device-specific commands and settings
1686 to the RIP which processes the job file. CUPS has extended this
1687 scope for PPDs to cover non-PostScript printers too. This was not
1688 difficult, because it is a standardized file format. In a way
1689 it was logical too: CUPS handles PostScript and uses a PostScript
1690 RIP (Ghostscript) to process the job files. The only difference is:
1691 a PostScript printer has the RIP built-in, for other types of
1692 printers the Ghostscript RIP runs on the host computer.
1696 PPDs for a non-PS printer have a few lines that are unique to
1697 CUPS. The most important one looks similar to this:
1699 <indexterm><primary>application/vnd.cups-raster</primary></indexterm>
1702 *cupsFilter: application/vnd.cups-raster 66 rastertoprinter
1705 It is the last piece in the CUPS filtering puzzle. This line tells the
1706 CUPS daemon to use as a last filter <parameter>rastertoprinter</parameter>. This filter
1707 should be served as input an <parameter>application/vnd.cups-raster</parameter> MIME type
1708 file. Therefore, CUPS should auto-construct a filtering chain, which
1709 delivers as its last output the specified MIME type. This is then
1710 taken as input to the specified <parameter>rastertoprinter</parameter> filter. After this
1711 the last filter has done its work (<parameter>rastertoprinter</parameter> is a Gimp-Print
1712 filter), the file should go to the backend, which sends it to the
1717 CUPS by default ships only a few generic PPDs, but they are good for
1718 several hundred printer models. You may not be able to control
1719 different paper trays, or you may get larger margins than your
1720 specific model supports. See <link linkend="cups-ppds">PPDs shipped with CUPS</link> for summary information.
1723 <table frame="all" id="cups-ppds">
1724 <title>PPDs shipped with CUPS</title>
1725 <tgroup cols="2" align="left">
1726 <colspec align="left"/>
1727 <colspec align="justify" colwidth="1*"/>
1728 <thead><row><entry>PPD file</entry><entry>Printer type</entry></row></thead>
1730 <row><entry>deskjet.ppd</entry><entry>older HP inkjet printers and compatible</entry></row>
1732 <row><entry>deskjet2.ppd</entry> <entry>newer HP inkjet printers and compatible </entry> </row>
1734 <row><entry>dymo.ppd</entry> <entry>label printers </entry> </row>
1736 <row><entry>epson9.ppd</entry> <entry>Epson 24pin impact printers and compatible </entry> </row>
1738 <row><entry>epson24.ppd</entry> <entry>Epson 24pin impact printers and compatible </entry> </row>
1740 <row><entry>okidata9.ppd</entry> <entry>Okidata 9pin impact printers and compatible </entry> </row>
1742 <row><entry>okidat24.ppd</entry> <entry>Okidata 24pin impact printers and compatible </entry> </row>
1744 <row><entry>stcolor.ppd</entry> <entry>older Epson Stylus Color printers </entry> </row>
1746 <row><entry>stcolor2.ppd</entry> <entry>newer Epson Stylus Color printers </entry> </row>
1748 <row><entry>stphoto.ppd</entry> <entry>older Epson Stylus Photo printers </entry> </row>
1750 <row><entry>stphoto2.ppd</entry> <entry>newer Epson Stylus Photo printers </entry> </row>
1752 <row><entry>laserjet.ppd</entry> <entry>all PCL printers. Further below is a discussion
1753 of several other driver/PPD-packages suitable for use with CUPS. </entry> </row>
1762 <title><emphasis>cupsomatic/foomatic-rip</emphasis> Versus <emphasis>native CUPS</emphasis> Printing</title>
1766 <indexterm><primary>cupsomatic</primary></indexterm>
1767 <indexterm><primary>foomatic-rip</primary></indexterm>
1768 Native CUPS rasterization works in two steps:
1773 First is the <parameter>pstoraster</parameter> step. It uses the special CUPS
1774 <indexterm><primary>ESP</primary><secondary>Ghostscript</secondary></indexterm>
1775 device from ESP Ghostscript 7.05.x as its tool.
1779 Second comes the <parameter>rasterdriver</parameter> step. It uses various
1780 device-specific filters; there are several vendors who provide good
1781 quality filters for this step. Some are free software, some are
1782 shareware/non-free and some are proprietary.</para></listitem>
1786 Often this produces better quality (and has several more
1787 advantages) than other methods.
1791 <image id="cupsomatic-dia">
1792 <imagedescription>cupsomatic/foomatic Processing versus Native CUPS.</imagedescription>
1793 <imagefile>10small</imagefile>
1798 One other method is the <parameter>cupsomatic/foomatic-rip</parameter>
1799 way. Note that <parameter>cupsomatic</parameter> is <emphasis>not</emphasis> made by the CUPS
1800 developers. It is an independent contribution to printing development,
1801 made by people from Linuxprinting.org <footnote><para>see also <ulink
1802 noescape="1" url="http://www.cups.org/cups-help.html">http://www.cups.org/cups-help.html</ulink></para></footnote>.
1803 <parameter>cupsomatic</parameter> is no longer developed and maintained and is no longer
1804 supported. It has now been replaced by
1805 <parameter>foomatic-rip</parameter>. <parameter>foomatic-rip</parameter> is a complete re-write
1806 of the old <parameter>cupsomatic</parameter> idea, but very much improved and generalized to
1807 other (non-CUPS) spoolers. An upgrade to foomatic-rip is strongly
1808 advised, especially if you are upgrading to a recent version of CUPS,
1813 <indexterm><primary>cupsomatic</primary></indexterm>
1814 <indexterm><primary>foomatic</primary></indexterm>
1815 Both the <parameter>cupsomatic</parameter> (old) and the <parameter>foomatic-rip</parameter> (new) methods from
1816 Linuxprinting.org use the traditional Ghostscript print file
1817 processing, doing everything in a single step. It therefore relies on
1818 all the other devices built into Ghostscript. The quality is as
1819 good (or bad) as Ghostscript rendering is in other spoolers. The
1820 advantage is that this method supports many printer models not
1821 supported (yet) by the more modern CUPS method.
1825 Of course, you can use both methods side by side on one system (and
1826 even for one printer, if you set up different queues) and find out
1827 which works best for you.
1831 <parameter>cupsomatic</parameter> kidnaps the printfile after the
1832 <parameter>application/vnd.cups-postscript</parameter> stage and
1833 deviates it through the CUPS-external, system-wide Ghostscript
1834 installation. Therefore the printfile bypasses the <parameter>pstoraster</parameter> filter
1835 (and also bypasses the CUPS-raster-drivers
1836 <parameter>rastertosomething</parameter>). After Ghostscript finished its rasterization,
1837 <parameter>cupsomatic</parameter> hands the rendered file directly to the CUPS backend. The
1838 flowchart in <link linkend="cupsomatic-dia">cupsomatic/foomatic processing versus Native CUPS</link> illustrates the difference between native CUPS
1839 rendering and the <parameter>Foomatic/cupsomatic</parameter> method.
1844 <title>Examples for Filtering Chains</title>
1847 Here are a few examples of commonly occurring filtering chains to
1848 illustrate the workings of CUPS.
1852 Assume you want to print a PDF file to an HP JetDirect-connected
1853 PostScript printer, but you want to print the pages 3-5, 7, 11-13
1854 only, and you want to print them <quote>two-up</quote> and <quote>duplex</quote>:
1858 <listitem><para>Your print options (page selection as required, two-up,
1859 duplex) are passed to CUPS on the command line.</para></listitem>
1861 <listitem><para>The (complete) PDF file is sent to CUPS and auto-typed as
1862 <parameter>application/pdf</parameter>.</para></listitem>
1864 <listitem><para>The file therefore must first pass the
1865 <parameter>pdftops</parameter> pre-filter, which produces PostScript
1866 MIME type <parameter>application/postscript</parameter> (a preview here
1867 would still show all pages of the original PDF).</para></listitem>
1869 <listitem><para>The file then passes the <parameter>pstops</parameter>
1870 filter that applies the command line options: it selects the pages
1871 2-5, 7 and 11-13, creates an imposed layout <quote>2 pages on 1 sheet</quote> and
1872 inserts the correct <quote>duplex</quote> command (as defined in the printer's
1873 PPD) into the new PostScript file; the file is now of PostScript MIME
1875 <parameter>application/vnd.cups-postscript</parameter>.</para></listitem>
1877 <listitem><para>The file goes to the <parameter>socket</parameter>
1878 backend, which transfers the job to the printers.</para></listitem>
1882 The resulting filter chain, therefore, is as drawn in <link linkend="pdftosocket">PDF to socket chain</link>.
1883 <image id="pdftosocket">
1884 <imagedescription>PDF to socket chain.</imagedescription>
1885 <imagefile>pdftosocket</imagefile>
1891 Assume you want to print the same filter to an USB-connected
1892 Epson Stylus Photo printer installed with the CUPS
1893 <filename>stphoto2.ppd</filename>. The first few filtering stages
1894 are nearly the same:
1898 <listitem><para>Your print options (page selection as required, two-up,
1899 duplex) are passed to CUPS on the command-line.</para></listitem>
1901 <listitem><para>The (complete) PDF file is sent to CUPS and auto-typed as
1902 <parameter>application/pdf</parameter>.</para></listitem>
1904 <listitem><para>The file must first pass the
1905 <parameter>pdftops</parameter> pre-filter, which produces PostScript
1906 MIME type <parameter>application/postscript</parameter> (a preview here
1907 would still show all pages of the original PDF).</para></listitem>
1909 <listitem><para>The file then passes the <quote>pstops</quote> filter that applies
1910 the command-line options: it selects the pages 2-5, 7 and 11-13,
1911 creates an imposed layout <quote>two pages on one sheet</quote> and inserts the
1912 correct <quote>duplex</quote> command... (Oops &smbmdash; this printer and PPD
1913 do not support duplex printing at all &smbmdash; so this option will
1914 be ignored) into the new PostScript file; the file is now of PostScript
1916 <parameter>application/vnd.cups-postscript</parameter>.</para></listitem>
1918 <listitem><para>The file then passes the
1920 <parameter>pstoraster</parameter> stage and becomes MIME type
1921 <parameter>application/
1922 cups-raster</parameter>.</para></listitem>
1924 <listitem><para>Finally, the <parameter>rastertoepson</parameter> filter
1925 does its work (as indicated in the printer's PPD), creating the
1926 printer-specific raster data and embedding any user-selected
1927 print-options into the print data stream.</para></listitem>
1929 <listitem><para>The file goes to the <parameter>usb</parameter> backend,
1930 which transfers the job to the printers.</para></listitem>
1934 The resulting filter chain therefore is as drawn in <link linkend="pdftoepsonusb">this figure</link>.
1937 <image id="pdftoepsonusb">
1938 <imagedescription>PDF to USB chain.</imagedescription>
1939 <imagefile>pdftoepsonusb</imagefile>
1944 <title>Sources of CUPS Drivers/PPDs</title>
1947 On the Internet you can now find many thousands of CUPS-PPD files
1948 (with their companion filters), in many national languages
1949 supporting more than thousand non-PostScript models.
1953 <indexterm><primary>ESP</primary><secondary>Print Pro</secondary></indexterm>
1954 <indexterm><primary>PrintPro</primary><see>ESP Print Pro</see></indexterm>
1955 <listitem><para><ulink url="http://wwwl.easysw.com/printpro/">ESP
1956 PrintPro</ulink> (commercial,
1957 non-free) is packaged with more than three thousand PPDs, ready for
1958 successful use <quote>out of the box</quote> on Linux, Mac OS X, IBM-AIX,
1959 HP-UX, Sun-Solaris, SGI-IRIX, Compaq Tru64, Digital UNIX, and some
1960 more commercial Unices (it is written by the CUPS developers
1961 themselves and its sales help finance the further development of
1962 CUPS, as they feed their creators).</para></listitem>
1964 <listitem><para>The <ulink
1965 url="http://gimp-print.sourceforge.net/">Gimp-Print-Project
1966 </ulink> (GPL, free software)
1967 provides around 140 PPDs (supporting nearly 400 printers, many driven
1968 to photo quality output), to be used alongside the Gimp-Print CUPS
1969 filters.</para></listitem>
1971 <listitem><para><ulink url="http://www.turboprint.com/">TurboPrint
1972 </ulink> (shareware, non-free) supports
1973 roughly the same amount of printers in excellent
1974 quality.</para></listitem>
1976 <listitem><para><ulink
1977 url="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/">OMNI
1979 (LPGL, free) is a package made by IBM, now containing support for more
1980 than 400 printers, stemming from the inheritance of IBM OS/2 Know-How
1981 ported over to Linux (CUPS support is in a beta-stage at
1982 present).</para></listitem>
1984 <listitem><para><ulink url="http://hpinkjet.sourceforge.net/">HPIJS
1985 </ulink> (BSD-style licenses, free)
1986 supports around 150 of HP's own printers and is also providing
1987 excellent print quality now (currently available only via the Foomatic
1988 path).</para></listitem>
1990 <listitem><para><ulink url="http://www.linuxprinting.org/">Foomatic/cupsomatic
1991 </ulink> (LPGL, free) from Linuxprinting.org are providing PPDs for practically every Ghostscript
1992 filter known to the world (including Omni, Gimp-Print and HPIJS).</para></listitem>
1998 <title>Printing with Interface Scripts</title>
2001 CUPS also supports the usage of <quote>interface scripts</quote> as known from
2002 System V AT&T printing systems. These are often used for PCL
2003 printers, from applications that generate PCL print jobs. Interface
2004 scripts are specific to printer models. They have a similar role as
2005 PPDs for PostScript printers. Interface scripts may inject the Escape
2006 sequences as required into the print data stream, if the user has
2007 chosen to select a certain paper tray, or print landscape, or use A3
2008 paper, etc. Interfaces scripts are practically unknown in the Linux
2009 realm. On HP-UX platforms they are more often used. You can use any
2010 working interface script on CUPS too. Just install the printer with
2011 the <command>-i</command> option:
2015 &rootprompt;<userinput>lpadmin -p pclprinter -v socket://11.12.13.14:9100 \
2016 -i /path/to/interface-script</userinput>
2020 Interface scripts might be the <quote>unknown animal</quote> to many. However,
2021 with CUPS they provide the easiest way to plug in your own
2022 custom-written filtering script or program into one specific print
2023 queue (some information about the traditional usage of interface scripts is
2024 to be found at <ulink
2025 noescape="1" url="http://playground.sun.com/printing/documentation/interface.html">http://playground.sun.com/printing/documentation/interface.html</ulink>).
2031 <title>Network Printing (Purely Windows)</title>
2034 Network printing covers a lot of ground. To understand what exactly
2035 goes on with Samba when it is printing on behalf of its Windows
2036 clients, let's first look at a <quote>purely Windows</quote> setup: Windows clients
2037 with a Windows NT print server.
2041 <title>From Windows Clients to an NT Print Server</title>
2044 Windows clients printing to an NT-based print server have two
2046 <indexterm><primary>GDI</primary></indexterm>
2047 <indexterm><primary>EMF</primary></indexterm>
2052 <listitem><para>Execute the driver locally and render the GDI output
2053 (EMF) into the printer-specific format on their own.
2056 <listitem><para>Send the GDI output (EMF) to the server, where the
2057 driver is executed to render the printer specific
2058 output.</para></listitem>
2062 Both print paths are shown in the flowcharts <link linkend="small11">Print driver
2063 execution on the client</link> and <link linkend="small12">Print driver execution on the server</link>.
2068 <title>Driver Execution on the Client</title>
2071 In the first case the print server must spool the file as raw,
2072 meaning it shouldn't touch the jobfile and try to convert it in any
2073 way. This is what a traditional UNIX-based print server can do too, and
2074 at a better performance and more reliably than an NT print server. This
2075 is what most Samba administrators probably are familiar with. One
2076 advantage of this setup is that this <quote>spooling-only</quote> print server may
2077 be used even if no driver(s) for UNIX are available it is sufficient
2078 to have the Windows client drivers available; and installed on the
2083 <image id="small11">
2084 <imagedescription>Print driver execution on the client.</imagedescription>
2085 <imagefile>11small</imagefile>
2091 <title>Driver Execution on the Server</title>
2095 <indexterm><primary>PostScript</primary></indexterm>
2096 <indexterm><primary>PCL</primary></indexterm>
2097 <indexterm><primary>ESC/P</primary></indexterm>
2098 <indexterm><primary>EMF</primary></indexterm>
2099 <indexterm><primary>GDI</primary></indexterm>
2100 The other path executes the printer driver on the server. The client
2101 transfers print files in EMF format to the server. The server uses the
2102 PostScript, PCL, ESC/P or other driver to convert the EMF file into
2103 the printer-specific language. It is not possible for UNIX to do the
2104 same. Currently, there is no program or method to convert a Windows
2105 client's GDI output on a UNIX server into something a printer could
2110 <image id="small12">
2111 <imagedescription>Print driver execution on the server.</imagedescription>
2112 <imagefile>12small</imagefile>
2117 However, there is something similar possible with CUPS. Read on.
2123 <title>Network Printing (Windows Clients &smbmdash; UNIX/Samba Print
2127 Since UNIX print servers <emphasis>cannot</emphasis> execute the Win32
2128 program code on their platform, the picture is somewhat
2129 different. However, this does not limit your options all that
2130 much. On the contrary, you may have a way here to implement printing
2131 features that are not possible otherwise.
2135 <title>From Windows Clients to a CUPS/Samba Print Server</title>
2138 Here is a simple recipe showing how you can take advantage of CUPS'
2139 powerful features for the benefit of your Windows network printing
2145 <listitem><para>Let the Windows clients send PostScript to the CUPS
2146 server.</para></listitem>
2148 <listitem><para>Let the CUPS server render the PostScript into device-specific raster format.</para></listitem>
2152 This requires the clients to use a PostScript driver (even if the
2153 printer is a non-PostScript model. It also requires that you have a
2154 driver on the CUPS server.
2158 First, to enable CUPS-based printing through Samba the
2159 following options should be set in your &smb.conf; file [global]
2164 <smbconfoption name="printing">cups</smbconfoption>
2165 <smbconfoption name="printcap">cups</smbconfoption>
2169 When these parameters are specified, all manually set print directives
2170 (like <smbconfoption name="print command"/>, or <smbconfoption name="lppause command"/>) in &smb.conf; (as well as
2171 in Samba itself) will be ignored. Instead, Samba will directly
2172 interface with CUPS through its application program interface (API),
2173 as long as Samba has been compiled with CUPS library (libcups)
2174 support. If Samba has not been compiled with CUPS support, and if no
2175 other print commands are set up, then printing will use the
2176 <emphasis>System V</emphasis> AT&T command set, with the -oraw
2177 option automatically passing through (if you want your own defined
2178 print commands to work with a Samba that has CUPS support compiled in,
2179 simply use <smbconfoption name="printing">sysv</smbconfoption>).
2184 <imagedescription>Printing via CUPS/Samba server.</imagedescription>
2185 <imagefile>13small</imagefile>
2191 <title>Samba Receiving Job-files and Passing Them to CUPS</title>
2194 Samba <emphasis>must</emphasis> use its own spool directory (it is set
2195 by a line similar to <smbconfoption name="path">/var/spool/samba</smbconfoption>,
2196 in the <smbconfsection name="[printers]"/> or
2197 <smbconfsection name="[printername]"/> section of
2198 &smb.conf;). Samba receives the job in its own
2199 spool space and passes it into the spool directory of CUPS (the CUPS
2200 spooling directory is set by the <parameter>RequestRoot</parameter>
2201 directive, in a line that defaults to <parameter>RequestRoot
2202 /var/spool/cups</parameter>). CUPS checks the access rights of its
2203 spool dir and resets it to healthy values with every restart. We have
2204 seen quite a few people who had used a common spooling space for Samba
2205 and CUPS, and were struggling for weeks with this <quote>problem.</quote>
2209 A Windows user authenticates only to Samba (by whatever means is
2210 configured). If Samba runs on the same host as CUPS, you only need to
2211 allow <quote>localhost</quote> to print. If they run on different machines, you
2212 need to make sure the Samba host gets access to printing on CUPS.
2218 <title>Network PostScript RIP</title>
2221 This section discusses the use of CUPS filters on the server &smbmdash; configuration where
2222 clients make use of a PostScript driver with CUPS-PPDs.
2227 <indexterm><primary>PostScript</primary></indexterm>
2228 <indexterm><primary>PCL</primary></indexterm>
2229 <indexterm><primary>PJL</primary></indexterm>
2230 PPDs can control all print device options. They are usually provided
2231 by the manufacturer, if you own a PostScript printer, that is. PPD
2232 files (PostScript Printer Descriptions) are always a component of
2233 PostScript printer drivers on MS Windows or Apple Mac OS systems. They
2234 are ASCII files containing user-selectable print options, mapped to
2235 appropriate PostScript, PCL or PJL commands for the target
2236 printer. Printer driver GUI dialogs translate these options
2237 <quote>on-the-fly</quote> into buttons and drop-down lists for the user to select.
2241 CUPS can load, without any conversions, the PPD file from any Windows
2242 (NT is recommended) PostScript driver and handle the options. There is
2243 a Web browser interface to the print options (select <ulink
2244 noescape="1" url="http://localhost:631/printers/">http://localhost:631/printers/</ulink>
2245 and click on one <guibutton>Configure Printer</guibutton> button to see
2246 it), or a command line interface (see <command>man lpoptions</command>
2247 or see if you have <command>lphelp</command> on your system). There are also some
2248 different GUI front-ends on Linux/UNIX, which can present PPD options
2249 to users. PPD options are normally meant to be evaluated by the
2250 PostScript RIP on the real PostScript printer.
2254 <title>PPDs for Non-PS Printers on UNIX</title>
2258 <indexterm><primary>PPD</primary></indexterm>
2259 CUPS does not limit itself to <quote>real</quote> PostScript printers in its usage
2260 of PPDs. The CUPS developers have extended the scope of the PPD
2261 concept to also describe available device and driver options for
2262 non-PostScript printers through CUPS-PPDs.
2266 This is logical, as CUPS includes a fully featured PostScript
2267 interpreter (RIP). This RIP is based on Ghostscript. It can process
2268 all received PostScript (and additionally many other file formats)
2269 from clients. All CUPS-PPDs geared to non-PostScript printers contain
2270 an additional line, starting with the keyword
2271 <parameter>*cupsFilter</parameter>. This line tells the CUPS print
2272 system which printer-specific filter to use for the interpretation of
2273 the supplied PostScript. Thus CUPS lets all its printers appear as
2274 PostScript devices to its clients, because it can act as a PostScript
2275 RIP for those printers, processing the received PostScript code into a
2276 proper raster print format.
2281 <title>PPDs for Non-PS Printers on Windows</title>
2284 <indexterm><primary>PPD</primary></indexterm>
2285 CUPS-PPDs can also be used on Windows-Clients, on top of a
2286 <quote>core</quote> PostScript driver (now recommended is the "CUPS PostScript
2287 Driver for Windows NT/200x/XP"; you can also use the Adobe one, with
2288 limitations). This feature enables CUPS to do a few tricks no other
2294 <listitem><para>Act as a networked PostScript RIP (Raster Image
2295 Processor), handling print files from all client platforms in a uniform
2296 way.</para></listitem>
2298 <listitem><para>Act as a central accounting and billing server, since
2299 all files are passed through the pstops filter and are, therefore,
2300 logged in the CUPS <filename>page_log</filename> file.
2301 <emphasis>Note:</emphasis> this cannot happen with <quote>raw</quote> print jobs,
2302 which always remain unfiltered per definition.</para></listitem>
2304 <listitem><para>Enable clients to consolidate on a single PostScript
2305 driver, even for many different target printers.</para></listitem>
2309 Using CUPS PPDs on Windows clients enables these to control
2310 all print job settings just as a UNIX client can do.
2316 <title>Windows Terminal Servers (WTS) as CUPS Clients</title>
2319 This setup may be of special interest to people experiencing major
2320 problems in WTS environments. WTS often need a multitude of
2321 non-PostScript drivers installed to run their clients' variety of
2322 different printer models. This often imposes the price of much
2323 increased instability.
2327 <title>Printer Drivers Running in <quote>Kernel Mode</quote> Cause Many
2331 In Windows NT printer drivers which run in <quote>Kernel
2332 Mode</quote>, introduces a high risk for the stability of the system
2333 if the driver is not really stable and well-tested. And there are a
2334 lot of bad drivers out there! Especially notorious is the example
2335 of the PCL printer driver that had an additional sound module
2336 running, to notify users via sound-card of their finished jobs. Do I
2337 need to say that this one was also reliably causing <quote>blue screens
2338 of death</quote> on a regular basis?
2342 PostScript drivers are generally well tested. They are not known
2343 to cause any problems, even though they also run in kernel mode. This
2344 might be because there have been so far only two different PostScript
2345 drivers: the ones from Adobe and the one from Microsoft. Both are
2346 well tested and are as stable as you can imagine on
2347 Windows. The CUPS driver is derived from the Microsoft one.
2352 <title>Workarounds Impose Heavy Limitations</title>
2355 In many cases, in an attempt to work around this problem, site
2356 administrators have resorted to restricting the allowed drivers installed
2357 on their WTS to one generic PCL and one PostScript driver. This,
2358 however, restricts the clients in the number of printer options
2359 available for them. Often they can't get out more than simplex
2360 prints from one standard paper tray, while their devices could do much
2361 better, if driven by a different driver!
2366 <title>CUPS: A <quote>Magical Stone</quote>?</title>
2370 <indexterm><primary>PPD</primary></indexterm>
2371 <indexterm><primary>PostScript</primary></indexterm>
2372 Using a PostScript driver, enabled with a CUPS-PPD, seems to be a very
2373 elegant way to overcome all these shortcomings. There are, depending
2374 on the version of Windows OS you use, up to three different PostScript
2375 drivers available: Adobe, Microsoft and CUPS PostScript drivers. None
2376 of them is known to cause major stability problems on WTS (even if
2377 used with many different PPDs). The clients will be able to (again)
2378 chose paper trays, duplex printing and other settings. However, there
2379 is a certain price for this too: a CUPS server acting as a PostScript
2380 RIP for its clients requires more CPU and RAM than when just acting as
2381 a <quote>raw spooling</quote> device. Plus, this setup is not yet widely tested,
2382 although the first feedbacks look very promising.
2387 <title>PostScript Drivers with No Major Problems &smbmdash; Even in Kernel
2391 <indexterm><primary>DDK</primary></indexterm>
2392 More recent printer drivers on W200x and XP no longer run in kernel mode
2393 (unlike Windows NT). However, both operating systems can still
2394 use the NT drivers, running in kernel mode (you can roughly tell which
2395 is which as the drivers in subdirectory <quote>2</quote> of <quote>W32X86</quote> are <quote>old</quote>
2396 ones). As was said before, the Adobe as well as the Microsoft
2397 PostScript drivers are not known to cause any stability problems. The
2398 CUPS driver is derived from the Microsoft one. There is a simple
2399 reason for this: The MS DDK (Device Development Kit) for Windows NT (which
2400 used to be available at no cost to licensees of Visual Studio)
2401 includes the source code of the Microsoft driver, and licensees of
2402 Visual Studio are allowed to use and modify it for their own driver
2403 development efforts. This is what the CUPS people have done. The
2404 license does not allow them to publish the whole of the source code.
2405 However, they have released the <quote>diff</quote> under the GPL, and if you are
2406 the owner of an <quote>MS DDK for Windows NT,</quote> you can check the driver yourself.
2412 <title>Configuring CUPS for Driver Download</title>
2415 As we have said before, all previously known methods to prepare client
2416 printer drivers on the Samba server for download and Point'n'Print
2417 convenience of Windows workstations are working with CUPS, too. These
2418 methods were described in the previous chapter. In reality, this is a
2419 pure Samba business and only relates to the Samba/Windows client
2424 <title><emphasis>cupsaddsmb</emphasis>: The Unknown Utility</title>
2428 <indexterm><primary>cupsaddsmb</primary></indexterm>
2429 The <command>cupsaddsmb</command> utility (shipped with all current CUPS versions) is an
2430 alternate method to transfer printer drivers into the Samba
2431 <smbconfsection name="[print$]"/> share. Remember, this share is where
2432 clients expect drivers deposited and setup for download and
2433 installation. It makes the sharing of any (or all) installed CUPS
2434 printers quite easy. <command>cupsaddsmb</command> can use the Adobe PostScript driver as
2435 well as the newly developed CUPS PostScript Driver for
2436 Windows NT/200x/XP. <parameter>cupsaddsmb</parameter> does
2437 <emphasis>not</emphasis> work with arbitrary vendor printer drivers,
2438 but only with the <emphasis>exact</emphasis> driver files that are
2439 named in its man page.
2443 The CUPS printer driver is available from the CUPS download site. Its
2444 package name is <filename>cups-samba-[version].tar.gz</filename> . It
2445 is preferred over the Adobe drivers since it has a number of
2450 <listitem><para>It supports a much more accurate page
2451 accounting.</para></listitem>
2453 <listitem><para>It supports banner pages, and page labels on all
2454 printers.</para></listitem>
2456 <listitem><para>It supports the setting of a number of job IPP
2457 attributes (such as job-priority, page-label and
2458 job-billing).</para></listitem>
2462 However, currently only Windows NT, 2000 and XP are supported by the
2463 CUPS drivers. You will also need to get the respective part of Adobe driver
2464 if you need to support Windows 95, 98 and ME clients.
2469 <title>Prepare Your &smb.conf; for <command>cupsaddsmb</command></title>
2472 Prior to running <command>cupsaddsmb</command>, you need the settings in
2473 &smb.conf; as shown in <link linkend="cupsadd-ex">the next example</link>:
2476 <para><smbconfexample id="cupsadd-ex">
2477 <title>smb.conf for cupsaddsmb usage</title>
2478 <smbconfsection name="[global]"/>
2479 <smbconfoption name="load printers">yes</smbconfoption>
2480 <smbconfoption name="printing">cups</smbconfoption>
2481 <smbconfoption name="printcap name">cups</smbconfoption>
2483 <smbconfsection name="[printers]"/>
2484 <smbconfoption name="comment">All Printers</smbconfoption>
2485 <smbconfoption name="path">/var/spool/samba</smbconfoption>
2486 <smbconfoption name="browseable">no</smbconfoption>
2487 <smbconfoption name="public">yes</smbconfoption>
2488 <smbconfcomment>setting depends on your requirements</smbconfcomment>
2489 <smbconfoption name="guest ok">yes</smbconfoption>
2490 <smbconfoption name="writable">no</smbconfoption>
2491 <smbconfoption name="printable">yes</smbconfoption>
2492 <smbconfoption name="printer admin">root</smbconfoption>
2493 <smbconfsection name="[print$]"/>
2494 <smbconfoption name="comment">Printer Drivers</smbconfoption>
2495 <smbconfoption name="path">/etc/samba/drivers</smbconfoption>
2496 <smbconfoption name="browseable">yes</smbconfoption>
2497 <smbconfoption name="guest ok">no</smbconfoption>
2498 <smbconfoption name="read only">yes</smbconfoption>
2499 <smbconfoption name="write list">root</smbconfoption>
2500 </smbconfexample></para>
2504 <title>CUPS <quote>PostScript Driver for Windows NT/200x/XP</quote></title>
2507 <indexterm><primary>PostScript</primary></indexterm>
2508 CUPS users may get the exact same packages from <ulink
2509 noescape="1" url="http://www.cups.org/software.html">http://www.cups.org/software.html</ulink>.
2510 It is a separate package from the CUPS base software files, tagged as
2511 CUPS 1.1.x Windows NT/200x/XP Printer Driver for Samba
2512 (tar.gz, 192k). The filename to download is
2513 <filename>cups-samba-1.1.x.tar.gz</filename>. Upon untar and unzipping,
2514 it will reveal these files:
2518 &rootprompt;<userinput>tar xvzf cups-samba-1.1.19.tar.gz</userinput>
2527 <indexterm><primary>ESP</primary><secondary>meta packager</secondary></indexterm>
2528 <indexterm><primary>EPM</primary><see>ESP meta packager</see></indexterm>
2529 These have been packaged with the ESP meta packager software
2530 EPM. The <filename>*.install</filename> and
2531 <filename>*.remove</filename> files are simple shell scripts, which
2532 untars the <filename>*.ss</filename> (the <filename>*.ss</filename> is
2533 nothing else but a tar-archive, which can be untarred by <quote>tar</quote>
2534 too). Then it puts the content into
2535 <filename>/usr/share/cups/drivers/</filename>. This content includes three
2540 &rootprompt;<userinput>tar tv cups-samba.ss</userinput>
2547 The <parameter>cups-samba.install</parameter> shell scripts are easy to
2552 &rootprompt;<userinput>./cups-samba.install</userinput>
2554 Installing software...
2555 Updating file permissions...
2556 Running post-install commands...
2557 Installation is complete.
2561 The script should automatically put the driver files into the
2562 <filename>/usr/share/cups/drivers/</filename> directory.
2566 Due to a bug, one recent CUPS release puts the
2567 <filename>cups.hlp</filename> driver file
2568 into<filename>/usr/share/drivers/</filename> instead of
2569 <filename>/usr/share/cups/drivers/</filename>. To work around this,
2570 copy/move the file (after running the
2571 <command>./cups-samba.install</command> script) manually to the
2576 &rootprompt;<userinput>cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/</userinput>
2581 <indexterm><primary>DDK</primary></indexterm>
2582 This new CUPS PostScript driver is currently binary-only, but free of
2583 charge. No complete source code is provided (yet). The reason is that
2584 it has been developed with the help of the Microsoft Driver
2585 Developer Kit (DDK) and compiled with Microsoft Visual
2586 Studio 6. Driver developers are not allowed to distribute the whole of
2587 the source code as free software. However, CUPS developers released
2588 the <quote>diff</quote> in source code under the GPL, so anybody with a license of
2589 Visual Studio and a DDK will be able to compile for him/herself.
2594 <title>Recognizing Different Driver Files</title>
2597 The CUPS drivers do not support the older Windows 95/98/Me, but only
2598 the Windows NT/2000/XP client.
2601 <para>Windows NT, 2000 and XP are supported by:</para>
2605 <listitem><para>cups.hlp</para></listitem>
2606 <listitem><para>cupsdrvr.dll</para></listitem>
2607 <listitem><para>cupsui.dll</para></listitem>
2612 Adobe drivers are available for the older Windows 95/98/Me as well as
2613 the Windows NT/2000/XP clients. The set of files is different from the
2614 different platforms.
2617 <para>Windows 95, 98 and ME are supported by:</para>
2621 <listitem><para>ADFONTS.MFM</para></listitem>
2622 <listitem><para>ADOBEPS4.DRV</para></listitem>
2623 <listitem><para>ADOBEPS4.HLP</para></listitem>
2624 <listitem><para>DEFPRTR2.PPD</para></listitem>
2625 <listitem><para>ICONLIB.DLL</para></listitem>
2626 <listitem><para>PSMON.DLL</para></listitem>
2630 <para>Windows NT, 2000 and XP are supported by:</para>
2634 <listitem><para>ADOBEPS5.DLL</para></listitem>
2635 <listitem><para>ADOBEPSU.DLL</para></listitem>
2636 <listitem><para>ADOBEPSU.HLP</para></listitem>
2642 If both the Adobe driver files and the CUPS driver files for the
2643 support of Windows NT/200x/XP are present in FIXME, the Adobe ones will be ignored
2644 and the CUPS ones will be used. If you prefer &smbmdash; for whatever reason
2645 &smbmdash; to use Adobe-only drivers, move away the three CUPS driver files. The
2646 Windows 9x/Me clients use the Adobe drivers in any case.
2651 <title>Acquiring the Adobe Driver Files</title>
2654 Acquiring the Adobe driver files seems to be unexpectedly difficult
2655 for many users. They are not available on the Adobe Web site as single
2656 files and the self-extracting and/or self-installing Windows-.exe is
2657 not easy to locate either. Probably you need to use the included
2658 native installer and run the installation process on one client
2659 once. This will install the drivers (and one Generic PostScript
2660 printer) locally on the client. When they are installed, share the
2661 Generic PostScript printer. After this, the client's
2662 <smbconfsection name="[print$]"/> share holds the Adobe files, from
2663 where you can get them with smbclient from the CUPS host.
2668 <title>ESP Print Pro PostScript Driver for Windows NT/200x/XP</title>
2673 <indexterm><primary>ESP</primary><secondary>Print Pro</secondary></indexterm>
2674 Users of the ESP Print Pro software are able to install their Samba
2675 drivers package for this purpose with no problem. Retrieve the driver
2676 files from the normal download area of the ESP Print Pro software
2678 noescape="1" url="http://www.easysw.com/software.html">http://www.easysw.com/software.html</ulink>.
2679 You need to locate the link labeled <quote>SAMBA</quote> among the
2680 <guilabel>Download Printer Drivers for ESP Print Pro 4.x</guilabel>
2681 area and download the package. Once installed, you can prepare any
2682 driver by simply highlighting the printer in the Printer Manager GUI
2683 and select <guilabel>Export Driver...</guilabel> from the menu. Of
2684 course you need to have prepared Samba beforehand to handle the
2685 driver files; i.e., setup the <smbconfsection name="[print$]"/>
2686 share, and so on. The ESP Print Pro package includes the CUPS driver files
2687 as well as a (licensed) set of Adobe drivers for the Windows 95/98/Me
2693 <title>Caveats to be Considered</title>
2697 <indexterm><primary>cupsaddsmb</primary></indexterm>
2698 Once you have run the install script (and possibly manually
2699 moved the <filename>cups.hlp</filename> file to
2700 <filename>/usr/share/cups/drivers/</filename>), the driver is
2701 ready to be put into Samba's <smbconfsection name="[print$]"/> share (which often maps to
2702 <filename>/etc/samba/drivers/</filename> and contains a subdirectory
2703 tree with <emphasis>WIN40</emphasis> and
2704 <emphasis>W32X86</emphasis> branches). You do this by running
2705 <command>cupsaddsmb</command> (see also <command>man cupsaddsmb</command> for
2706 CUPS since release 1.1.16).
2710 <indexterm><primary>Single Sign On</primary></indexterm>
2711 You may need to put root into the smbpasswd file by running
2712 <command>smbpasswd</command>; this is especially important if you
2713 should run this whole procedure for the first time, and are not
2714 working in an environment where everything is configured for
2715 <emphasis>single sign on</emphasis> to a Windows Domain Controller.
2719 Once the driver files are in the <smbconfsection name="[print$]"/> share
2720 and are initialized, they are ready to be downloaded and installed by
2721 the Windows NT/200x/XP clients.
2725 Win 9x/Me clients will not work with the CUPS PostScript driver. For
2726 these you still need to use the <filename>ADOBE*.*</filename>
2727 drivers as previously stated.
2732 It is not harmful if you still have the
2733 <filename>ADOBE*.*</filename> driver files from previous
2734 installations in the <filename>/usr/share/cups/drivers/</filename>
2735 directory. The new <command>cupsaddsmb</command> (from 1.1.16) will
2736 automatically prefer its own drivers if it finds both.
2740 <indexterm><primary>"Printers" folder</primary></indexterm>
2741 Should your Windows clients have had the old <filename>ADOBE*.*</filename>
2742 files for the Adobe PostScript driver installed, the download and
2743 installation of the new CUPS PostScript driver for Windows NT/200x/XP
2744 will fail at first. You need to wipe the old driver from the clients
2745 first. It is not enough to <quote>delete</quote> the printer, as the driver files
2746 will still be kept by the clients and re-used if you try to re-install
2747 the printer. To really get rid of the Adobe driver files on the
2748 clients, open the <guilabel>Printers</guilabel> folder (possibly via <guilabel>Start > Settings > Control Panel > Printers</guilabel>),
2749 right-click on the folder background and select <guimenuitem>Server
2750 Properties</guimenuitem>. When the new dialog opens, select the
2751 <guilabel>Drivers</guilabel> tab. On the list select the driver you
2752 want to delete and click the <guilabel>Delete</guilabel>
2753 button. This will only work if there is not one single printer left
2754 that uses that particular driver. You need to <quote>delete</quote> all printers
2755 using this driver in the <guilabel>Printers</guilabel> folder first. You will need
2756 Administrator privileges to do this.
2760 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
2761 Once you have successfully downloaded the CUPS PostScript driver to a
2762 client, you can easily switch all printers to this one by proceeding
2763 as described in <link linkend="printing">Classical Printing Support</link>. Either change
2764 a driver for an existing printer by running the <guilabel>Printer Properties</guilabel>
2765 dialog, or use <command>rpcclient</command> with the
2766 <command>setdriver</command> subcommand.
2771 <title>Windows CUPS PostScript Driver Versus Adobe Driver</title>
2774 Are you interested in a comparison between the CUPS and the Adobe
2775 PostScript drivers? For our purposes these are the most important
2776 items that weigh in favor of the CUPS ones:
2780 <listitem><para>No hassle with the Adobe EULA.</para></listitem>
2782 <listitem><para>No hassle with the question <quote>Where do I
2783 get the ADOBE*.* driver files from?</quote></para></listitem>
2786 <indexterm><primary>PJL</primary></indexterm>
2787 The Adobe drivers (on request of the printer PPD
2788 associated with them) often put a PJL header in front of the main
2789 PostScript part of the print file. Thus, the printfile starts with
2790 <parameter><1B >%-12345X</parameter> or
2791 <parameter><escape>%-12345X</parameter> instead
2792 of <parameter>%!PS</parameter>). This leads to the
2793 CUPS daemon auto-typing the incoming file as a print-ready file,
2794 not initiating a pass through the <parameter>pstops</parameter> filter (to speak more
2795 technically, it is not regarded as the generic MIME-type
2796 <indexterm><primary>application/postscript</primary></indexterm>
2797 <parameter>application/postscript</parameter>, but as
2798 the more special MIME type
2799 <indexterm><primary>application/cups.vnd-postscript</primary></indexterm>
2800 <parameter>application/cups.vnd-postscript</parameter>),
2801 which therefore also leads to the page accounting in
2802 <parameter>/var/log/cups/page_log</parameter> not
2803 receiving the exact number of pages; instead the dummy page number
2804 of <quote>1</quote> is logged in a standard setup).</para></listitem>
2806 <listitem><para>The Adobe driver has more options to mis-configure the
2807 PostScript generated by it (like setting it inadvertently to
2808 <guilabel>Optimize for Speed</guilabel>, instead of
2809 <guilabel>Optimize for Portability</guilabel>, which
2810 could lead to CUPS being unable to process it).</para></listitem>
2812 <listitem><para>The CUPS PostScript driver output sent by Windows
2813 clients to the CUPS server is guaranteed to auto-type
2814 as the generic MIME type <parameter>application/postscript</parameter>,
2815 thus passing through the CUPS <parameter>pstops</parameter> filter and logging the
2816 correct number of pages in the <filename>page_log</filename> for
2817 accounting and quota purposes.</para></listitem>
2819 <listitem><para>The CUPS PostScript driver supports the sending of
2820 additional standard (IPP) print options by Windows NT/200x/XP clients. Such
2821 additional print options are: naming the CUPS standard
2822 <emphasis>banner pages</emphasis> (or the custom ones, should they be
2823 installed at the time of driver download), using the CUPS
2824 page-label option, setting a
2825 job-priority, and setting the scheduled
2826 time of printing (with the option to support additional
2827 useful IPP job attributes in the future).</para></listitem>
2829 <listitem><para>The CUPS PostScript driver supports the inclusion of
2830 the new <parameter>*cupsJobTicket</parameter> comments at the
2831 beginning of the PostScript file (which could be used in the future
2832 for all sort of beneficial extensions on the CUPS side, but which will
2833 not disturb any other applications as they will regard it as a comment
2834 and simply ignore it).</para></listitem>
2836 <listitem><para>The CUPS PostScript driver will be the heart of the
2837 fully fledged CUPS IPP client for Windows NT/200x/XP to be released soon
2838 (probably alongside the first beta release for CUPS
2839 1.2).</para></listitem>
2845 <title>Run cupsaddsmb (Quiet Mode)</title>
2849 <indexterm><primary>cupsaddsmb</primary></indexterm>
2850 <indexterm><primary>point 'n' print</primary></indexterm>
2851 The <command>cupsaddsmb</command> command copies the needed files into your
2852 <smbconfsection name="[print$]"/> share. Additionally, the PPD
2853 associated with this printer is copied from
2854 <filename>/etc/cups/ppd/</filename> to
2855 <smbconfsection name="[print$]"/>. There the files wait for convenient
2856 Windows client installations via Point'n'Print. Before we can run the
2857 command successfully, we need to be sure that we can authenticate
2858 toward Samba. If you have a small network, you are probably using user-level
2859 security (<smbconfoption name="security">user</smbconfoption>).
2863 Here is an example of a successfully run <command>cupsaddsmb</command> command:
2867 &rootprompt;<userinput>cupsaddsmb -U root infotec_IS2027</userinput>
2868 Password for root required to access localhost via Samba: <userinput>['secret']</userinput>
2872 To share <emphasis>all</emphasis> printers and drivers, use the
2873 <option>-a</option> parameter instead of a printer name. Since
2874 <command>cupsaddsmb</command> <quote>exports</quote> the printer drivers to Samba, it should be
2875 obvious that it only works for queues with a CUPS driver associated.
2880 <title>Run cupsaddsmb with Verbose Output</title>
2884 <indexterm><primary>cupsaddsmb</primary></indexterm>
2885 Probably you want to see what's going on. Use the
2886 <option>-v</option> parameter to get a more verbose output. The
2887 output below was edited for better readability: all <quote>\</quote> at the end of
2888 a line indicate that I inserted an artificial line break plus some
2893 You will see the root password for the Samba account printed on
2899 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
2900 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
2902 &rootprompt;<userinput>cupsaddsmb -U root -v infotec_2105</userinput>
2903 Password for root required to access localhost via &example.server.samba;:
2904 Running command: smbclient //localhost/print\$ -N -U'root%secret' \
2906 put /var/spool/cups/tmp/3e98bf2d333b5 W32X86/infotec_2105.ppd; \
2907 put /usr/share/cups/drivers/cupsdrvr.dll W32X86/cupsdrvr.dll; \
2908 put /usr/share/cups/drivers/cupsui.dll W32X86/cupsui.dll; \
2909 put /usr/share/cups/drivers/cups.hlp W32X86/cups.hlp'
2910 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
2911 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
2912 NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86
2913 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \W32X86/infotec_2105.ppd
2914 putting file /usr/share/cups/drivers/cupsdrvr.dll as \W32X86/cupsdrvr.dll
2915 putting file /usr/share/cups/drivers/cupsui.dll as \W32X86/cupsui.dll
2916 putting file /usr/share/cups/drivers/cups.hlp as \W32X86/cups.hlp
2918 Running command: rpcclient localhost -N -U'root%secret'
2919 -c 'adddriver "Windows NT x86" \
2920 "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \
2922 cmd = adddriver "Windows NT x86" \
2923 "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \
2925 Printer Driver infotec_2105 successfully installed.
2927 Running command: smbclient //localhost/print\$ -N -U'root%secret' \
2929 put /var/spool/cups/tmp/3e98bf2d333b5 WIN40/infotec_2105.PPD; \
2930 put /usr/share/cups/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM; \
2931 put /usr/share/cups/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV; \
2932 put /usr/share/cups/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP; \
2933 put /usr/share/cups/drivers/DEFPRTR2.PPD WIN40/DEFPRTR2.PPD; \
2934 put /usr/share/cups/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL; \
2935 put /usr/share/cups/drivers/PSMON.DLL WIN40/PSMON.DLL;'
2936 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
2937 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
2938 NT_STATUS_OBJECT_NAME_COLLISION making remote directory \WIN40
2939 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \WIN40/infotec_2105.PPD
2940 putting file /usr/share/cups/drivers/ADFONTS.MFM as \WIN40/ADFONTS.MFM
2941 putting file /usr/share/cups/drivers/ADOBEPS4.DRV as \WIN40/ADOBEPS4.DRV
2942 putting file /usr/share/cups/drivers/ADOBEPS4.HLP as \WIN40/ADOBEPS4.HLP
2943 putting file /usr/share/cups/drivers/DEFPRTR2.PPD as \WIN40/DEFPRTR2.PPD
2944 putting file /usr/share/cups/drivers/ICONLIB.DLL as \WIN40/ICONLIB.DLL
2945 putting file /usr/share/cups/drivers/PSMON.DLL as \WIN40/PSMON.DLL
2947 Running command: rpcclient localhost -N -U'root%secret' \
2948 -c 'adddriver "Windows 4.0" \
2949 "infotec_2105:ADOBEPS4.DRV:infotec_2105.PPD:NULL:ADOBEPS4.HLP: \
2950 PSMON.DLL:RAW:ADOBEPS4.DRV,infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL, \
2951 ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"'
2952 cmd = adddriver "Windows 4.0" "infotec_2105:ADOBEPS4.DRV:\
2953 infotec_2105.PPD:NULL:ADOBEPS4.HLP:PSMON.DLL:RAW:ADOBEPS4.DRV,\
2954 infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL,ADFONTS.MFM,DEFPRTR2.PPD,\
2956 Printer Driver infotec_2105 successfully installed.
2958 Running command: rpcclient localhost -N -U'root%secret' \
2959 -c 'setdriver infotec_2105 infotec_2105'
2960 cmd = setdriver infotec_2105 infotec_2105
2961 Successfully set infotec_2105 to driver infotec_2105.
2966 If you look closely, you'll discover your root password was transferred
2967 unencrypted over the wire, so beware! Also, if you look further,
2968 you'll discover error messages like <?latex \linebreak ?>NT_STATUS_OBJECT_NAME_COLLISION in between. They occur, because the directories WIN40 and W32X86 already existed in the <smbconfsection name="[print$]"/> driver download share (from a previous driver installation). They are harmless here.
2973 <title>Understanding cupsaddsmb</title>
2977 <indexterm><primary>cupsaddsmb</primary></indexterm>
2978 What has happened? What did <command>cupsaddsmb</command> do? There are five stages of
2984 <indexterm><primary>IPP</primary></indexterm>
2985 Call the CUPS server via IPP and request the
2986 driver files and the PPD file for the named printer.</para></listitem>
2988 <listitem><para>Store the files temporarily in the local
2989 TEMPDIR (as defined in
2990 <filename>cupsd.conf</filename>).</para></listitem>
2992 <listitem><para>Connect via smbclient to the Samba server's
2993 <smbconfsection name="[print$]"/> share and put the files into the
2994 share's WIN40 (for Windows 9x/Me) and W32X86/ (for Windows NT/200x/XP) subdirectories.</para></listitem>
2997 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
2998 Connect via rpcclient to the Samba server and
2999 execute the <command>adddriver</command> command with the correct
3000 parameters.</para></listitem>
3003 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3004 Connect via rpcclient to the Samba server a second
3005 time and execute the <command>setdriver</command> command.</para></listitem>
3010 You can run the <command>cupsaddsmb</command> utility with parameters to
3011 specify one remote host as Samba host and a second remote host as CUPS
3012 host. Especially if you want to get a deeper understanding, it is a
3013 good idea to try it and see more clearly what is going on (though in real
3014 life most people will have their CUPS and Samba servers run on the
3019 &rootprompt;<userinput>cupsaddsmb -H sambaserver -h cupsserver -v printer</userinput>
3025 <title>How to Recognize If cupsaddsmb Completed Successfully</title>
3028 You <emphasis>must</emphasis> always check if the utility completed
3029 successfully in all fields. You need as a minimum these three messages
3035 <listitem><para><emphasis>Printer Driver infotec_2105 successfully
3036 installed.</emphasis> # (for the W32X86 == Windows NT/200x/XP
3037 architecture).</para></listitem>
3039 <listitem><para><emphasis>Printer Driver infotec_2105 successfully
3040 installed.</emphasis> # (for the WIN40 == Windows 9x/Me
3041 architecture).</para></listitem>
3043 <listitem><para><emphasis>Successfully set [printerXPZ] to driver
3044 [printerXYZ].</emphasis></para></listitem>
3048 These messages are probably not easily recognized in the general
3049 output. If you run <command>cupsaddsmb</command> with the <option>-a</option>
3050 parameter (which tries to prepare <emphasis>all</emphasis> active CUPS
3051 printer drivers for download), you might miss if individual printers
3052 drivers had problems installing properly. Here a redirection of the
3053 output will help you analyze the results in retrospective.
3059 SetPrinter call failed!
3060 result was WERR_ACCESS_DENIED
3062 It means that you might have set <smbconfoption name="use client driver">yes</smbconfoption> for this printer.
3063 Set it to <quote>no</quote> will solve the problem. Refer to man samba(5) for explanantion on
3064 <parameter>use client driver</parameter>.
3068 It is impossible to see any diagnostic output if you do not run
3069 <command>cupsaddsmb</command> in verbose mode. Therefore, we strongly recommend to not
3070 use the default quiet mode. It will hide any problems from you that
3076 <title>cupsaddsmb with a Samba PDC</title>
3080 <indexterm><primary>cupsaddsmb</primary></indexterm>
3081 Can't get the standard <command>cupsaddsmb</command> command to run on a Samba PDC?
3082 Are you asked for the password credential all over again and again and
3083 the command just will not take off at all? Try one of these
3088 &rootprompt;<userinput>cupsaddsmb -U &example.workgroup;\\root -v printername</userinput>
3089 &rootprompt;<userinput>cupsaddsmb -H &example.pdc.samba; -U &example.workgroup;\\root -v printername</userinput>
3090 &rootprompt;<userinput>cupsaddsmb -H &example.pdc.samba; -U &example.workgroup;\\root -h cups-server -v printername</userinput>
3094 (Note the two backslashes: the first one is required to
3095 <quote>escape</quote> the second one).
3100 <title>cupsaddsmb Flowchart</title>
3103 <indexterm><primary>cupsaddsmb</primary></indexterm>
3104 <link linkend="small14">cupsaddsmb flowchart</link> shows a chart about the procedures, command-flows and
3105 data-flows of the <command>cupaddsmb</command> command. Note again: cupsaddsmb is
3106 not intended to, and does not work with, raw queues!
3110 <image id="small14">
3111 <imagedescription>cupsaddsmb flowchart.</imagedescription>
3112 <imagefile>14small</imagefile></image>
3117 <title>Installing the PostScript Driver on a Client</title>
3120 <indexterm><primary>point 'n' print</primary></indexterm>
3121 After <command>cupsaddsmb</command> is completed, your driver is prepared for the clients to
3122 use. Here are the steps you must perform to download and install it
3123 via Point'n'Print. From a Windows client, browse to the CUPS/Samba
3131 <indexterm><primary>"Printers" folder</primary></indexterm>
3132 Open the <guilabel>Printers</guilabel>
3133 share of Samba in Network Neighborhood.</para></listitem>
3135 <listitem><para>Right-click on the printer in
3136 question.</para></listitem>
3138 <listitem><para>From the opening context-menu select
3139 <guimenuitem>Install...</guimenuitem> or
3140 <guimenuitem>Connect...</guimenuitem> (depending on the Windows version you
3141 use).</para></listitem>
3145 After a few seconds, there should be a new printer in your
3146 client's <emphasis>local</emphasis> <guilabel>Printers</guilabel> folder. On Windows
3147 XP it will follow a naming convention of <emphasis>PrinterName on
3148 SambaServer</emphasis>. (In my current case it is "infotec_2105 on
3149 kde-bitshop"). If you want to test it and send your first job from
3150 an application like Winword, the new printer appears in a
3151 <filename>\\SambaServer\PrinterName</filename> entry in the
3152 drop-down list of available printers.
3156 <indexterm><primary>PPD</primary></indexterm>
3157 <command>cupsaddsmb</command> will only reliably work with CUPS version 1.1.15 or higher
3158 and Samba from 2.2.4. If it does not work, or if the automatic printer
3159 driver download to the clients does not succeed, you can still manually
3160 install the CUPS printer PPD on top of the Adobe PostScript driver on
3161 clients. Then point the client's printer queue to the Samba printer
3162 share for a UNC type of connection:
3166 &dosprompt;<userinput>net use lpt1: \\sambaserver\printershare /user:ntadmin</userinput>
3170 should you desire to use the CUPS networked PostScript RIP
3171 functions. (Note that user <quote>ntadmin</quote> needs to be a valid Samba user
3172 with the required privileges to access the printershare.) This
3173 sets up the printer connection in the traditional
3174 <emphasis>LanMan</emphasis> way (not using MS-RPC).
3179 <title>Avoiding Critical PostScript Driver Settings on the Client</title>
3182 Printing works, but there are still problems. Most jobs print
3183 well, some do not print at all. Some jobs have problems with fonts,
3184 which do not look very good. Some jobs print fast and some are
3185 dead-slow. Many of these problems can be greatly reduced or even
3186 completely eliminated if you follow a few guidelines. Remember, if
3187 your print device is not PostScript-enabled, you are treating your
3188 Ghostscript installation on your CUPS host with the output your client
3189 driver settings produce. Treat it well:
3193 <listitem><para>Avoid the PostScript Output Option: Optimize
3194 for Speed setting. Use the Optimize for
3195 Portability instead (Adobe PostScript
3196 driver).</para></listitem>
3198 <listitem><para>Don't use the Page Independence:
3199 NO setting. Instead, use Page Independence
3200 YES (CUPS PostScript Driver).</para></listitem>
3202 <listitem><para>Recommended is the True Type Font
3203 Downloading Option: Native True Type over
3204 Automatic and Outline; you
3205 should by all means avoid Bitmap (Adobe
3206 PostScript Driver).</para></listitem>
3208 <listitem><para>Choose True Type Font: Download as Softfont
3209 into Printer over the default Replace by Device
3210 Font (for exotic fonts, you may need to change it back to
3211 get a printout at all) (Adobe).</para></listitem>
3213 <listitem><para>Sometimes you can choose PostScript Language
3214 Level: In case of problems try 2
3215 instead of 3 (the latest ESP Ghostscript package
3216 handles Level 3 PostScript very well) (Adobe).</para></listitem>
3218 <listitem><para>Say Yes to PostScript
3219 Error Handler (Adobe).</para></listitem>
3225 <title>Installing PostScript Driver Files Manually Using rpcclient</title>
3228 Of course, you can run all the commands that are embedded into the
3229 cupsaddsmb convenience utility yourself, one by one, and hereby upload
3230 and prepare the driver files for future client downloads.
3234 <listitem><para>Prepare Samba (A CUPS print queue with the name of the
3235 printer should be there. We are providing the driver
3236 now).</para></listitem>
3238 <listitem><para>Copy all files to
3239 <smbconfsection name="[print$]"/>.</para></listitem>
3242 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3243 Run <command>rpcclient adddriver</command>
3244 (for each client architecture you want to support).</para></listitem>
3247 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3248 Run <command>rpcclient
3249 setdriver.</command></para></listitem>
3253 <indexterm><primary>rpcclient</primary><secondary>enumports</secondary></indexterm>
3254 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3255 <indexterm><primary>rpcclient</primary><secondary>enumdrivers</secondary></indexterm>
3256 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3257 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3258 We are going to do this now. First, read the man page on <parameter>rpcclient</parameter>
3259 to get a first idea. Look at all the printing related
3260 subcommands. <command>enumprinters</command>,
3261 <command>enumdrivers</command>, <command>enumports</command>,
3262 <command>adddriver</command>, <command>setdriver</command> are among
3263 the most interesting ones. <parameter>rpcclient</parameter> implements an important part of
3264 the MS-RPC protocol. You can use it to query (and command) a Windows NT
3265 (or 200x/XP) PC, too. MS-RPC is used by Windows clients, among other
3266 things, to benefit from the Point'n'Print features. Samba can now
3271 <title>A Check of the rpcclient man Page</title>
3274 First let's check the <parameter>rpcclient</parameter> man page. Here are
3275 two relevant passages:
3279 <command>adddriver <arch> <config></command> Execute an
3280 <command>AddPrinterDriver()</command> RPC to install the printer driver information on
3281 the server. The driver files should already exist in the
3282 directory returned by <command>getdriverdir</command>. Possible
3283 values for <parameter>arch</parameter> are the same as those for the
3284 <command>getdriverdir</command> command. The
3285 <parameter>config</parameter> parameter is defined as follows:
3294 Language Monitor Name:\
3296 Comma Separated list of Files
3299 <para>Any empty fields should be enter as the string <quote>NULL</quote>. </para>
3301 <para>Samba does not need to support the concept of Print Monitors
3302 since these only apply to local printers whose driver can make use of
3303 a bi-directional link for communication. This field should be <quote>NULL</quote>.
3304 On a remote NT print server, the Print Monitor for a driver must
3305 already be installed prior to adding the driver or else the RPC will
3310 <command>setdriver <printername> <drivername></command>
3311 Execute a <command>SetPrinter()</command> command to update the
3312 printer driver associated with an installed printer. The printer
3313 driver must already be correctly installed on the print server.
3316 <para>See also the <command>enumprinters</command> and <command>enumdrivers</command> commands for
3317 obtaining a list of installed printers and drivers.
3323 <title>Understanding the rpcclient man Page</title>
3326 The <emphasis>exact</emphasis> format isn't made too clear by the man
3327 page, since you have to deal with some parameters containing
3328 spaces. Here is a better description for it. We have line-broken the
3329 command and indicated the breaks with <quote>\</quote>. Usually you would type the
3330 command in one line without the line-breaks:
3331 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3335 adddriver "Architecture" \
3336 "LongPrinterName:DriverFile:DataFile:ConfigFile:HelpFile:\
3337 LanguageMonitorFile:DataType:ListOfFiles,Comma-separated"
3341 What the man pages denote as a simple <parameter><config></parameter>
3342 keyword, in reality consists of eight colon-separated fields. The
3343 last field may take multiple (in some very insane cases, even
3344 20 different additional) files. This might sound confusing at first.
3345 What the man pages names the <quote>LongPrinterName</quote> in
3346 reality should be called the <quote>Driver Name</quote>. You can name it
3347 anything you want, as long as you use this name later in the
3348 <command>rpcclient ... setdriver</command> command. For
3349 practical reasons, many name the driver the same as the
3354 It isn't simple at all. I hear you asking:
3355 <quote>How do I know which files are "Driver
3356 File</quote>, <quote>Data File</quote>, <quote>Config File</quote>, <quote>Help File</quote> and <quote>Language
3357 Monitor File" in each case?</quote> &smbmdash; For an answer, you may
3358 want to have a look at how a Windows NT box with a shared printer
3359 presents the files to us. Remember, that this whole procedure has
3360 to be developed by the Samba team by overhearing the traffic caused
3361 by Windows computers on the wire. We may as well turn to a Windows
3362 box now and access it from a UNIX workstation. We will query it
3363 with <command>rpcclient</command> to see what it tells us and
3364 try to understand the man page more clearly that we've read just
3370 <title>Producing an Example by Querying a Windows Box</title>
3373 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3374 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3375 We could run <command>rpcclient</command> with a
3376 <command>getdriver</command> or a <command>getprinter</command>
3377 subcommand (in level 3 verbosity) against it. Just sit down at a UNIX or
3378 Linux workstation with the Samba utilities installed, then type the
3383 &rootprompt;<userinput>rpcclient -U'user%secret' NT-SERVER -c 'getdriver printername 3'</userinput>
3387 From the result it should become clear which is which. Here is an example from my installation:
3391 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3393 &rootprompt;<userinput>rpcclient -U'Danka%xxxx' W200xSERVER \
3394 -c'getdriver "DANKA InfoStream Virtual Printer" 3'</userinput>
3395 cmd = getdriver "DANKA InfoStream Virtual Printer" 3
3398 Printer Driver Info 3:
3400 Driver Name: [DANKA InfoStream]
3401 Architecture: [Windows NT x86]
3402 Driver Path: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRIPT.DLL]
3403 Datafile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\INFOSTRM.PPD]
3404 Configfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRPTUI.DLL]
3405 Helpfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRIPT.HLP]
3421 Some printer drivers list additional files under the label
3422 <parameter>Dependentfiles</parameter> and these would go into the last field
3423 <parameter>ListOfFiles,Comma-separated</parameter>. For the CUPS
3424 PostScript drivers, we do not need any (nor would we for the Adobe
3425 PostScript driver), therefore, the field will get a <quote>NULL</quote> entry.
3430 <title>Requirements for adddriver and setdriver to Succeed</title>
3433 >From the man page (and from the quoted output
3434 of <command>cupsaddsmb</command> above) it becomes clear that you
3435 need to have certain conditions in order to make the manual uploading
3436 and initializing of the driver files succeed. The two <command>rpcclient</command>
3437 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3438 subcommands (<command>adddriver</command> and
3439 <command>setdriver</command>) need to encounter the following
3440 preconditions to complete successfully:
3444 <listitem><para>You are connected as <smbconfoption name="printer admin"/> or root (this is <emphasis>not</emphasis> the <quote>Printer Operators</quote> group in
3445 NT, but the <emphasis>printer admin</emphasis> group as defined in
3446 the <smbconfsection name="[global]"/> section of
3447 &smb.conf;).</para></listitem>
3449 <listitem><para>Copy all required driver files to
3450 <filename>\\SAMBA\print$\w32x86</filename> and
3451 <filename>\\SAMBA\print$\win40</filename> as appropriate. They
3452 will end up in the <quote>0</quote> respective <quote>2</quote> subdirectories later. For now,
3453 <emphasis>do not</emphasis> put them there, they'll be automatically
3454 used by the <command>adddriver</command> subcommand. (If you use
3455 <command>smbclient</command> to put the driver files into the share, note that you need
3456 to escape the <quote>$</quote>: <command>smbclient //sambaserver/print\$ -U
3457 root.</command>)</para></listitem>
3459 <listitem><para>The user you're connecting as must be able to write to
3460 the <smbconfsection name="[print$]"/> share and create
3461 subdirectories.</para></listitem>
3463 <listitem><para>The printer you are going to setup for the Windows
3464 clients needs to be installed in CUPS already.</para></listitem>
3467 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3468 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3469 The CUPS printer must be known to Samba, otherwise the
3470 <command>setdriver</command> subcommand fails with an
3471 NT_STATUS_UNSUCCESSFUL error. To check if the printer is known by
3472 Samba, you may use the <command>enumprinters</command> subcommand to
3473 <command>rpcclient</command>. A long-standing bug prevented a proper update of the
3474 printer list until every smbd process had received a SIGHUP or was
3475 restarted. Remember this in case you've created the CUPS printer just
3476 recently and encounter problems: try restarting
3477 Samba.</para></listitem>
3482 <title>Manual Driver Installation in 15 Steps</title>
3485 We are going to install a printer driver now by manually executing all
3486 required commands. As this may seem a rather complicated process at
3487 first, we go through the procedure step by step, explaining every
3488 single action item as it comes up.
3492 <title>Manual Driver Installation</title>
3495 <title>Install the printer on CUPS.</title>
3498 &rootprompt;<userinput>lpadmin -p mysmbtstprn -v socket://10.160.51.131:9100 -E \
3499 -P canonIR85.ppd</userinput>
3503 This installs a printer with the name <parameter>mysmbtstprn</parameter>
3504 to the CUPS system. The printer is accessed via a socket
3505 (a.k.a. JetDirect or Direct TCP/IP) connection. You need to be root
3511 <title>(Optional) Check if the printer is recognized by Samba.</title>
3514 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3516 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'enumprinters' localhost \
3517 | grep -C2 mysmbtstprn</userinput>
3519 name:[\\kde-bitshop\mysmbtstprn]
3520 description:[\\kde-bitshop\mysmbtstprn,,mysmbtstprn]
3521 comment:[mysmbtstprn]
3525 This should show the printer in the list. If not, stop and restart
3526 the Samba daemon (smbd), or send a HUP signal:
3528 &rootprompt;<userinput>kill -HUP `pidof smbd`</userinput>
3529 </screen>Check again. Troubleshoot and repeat until
3530 successful. Note the <quote>empty</quote> field between the two commas in the
3531 <quote>description</quote> line. The driver name would appear here if there was one already. You need to know root's Samba password (as set by the
3532 <command>smbpasswd</command> command) for this step and most of the
3533 following steps. Alternately, you can authenticate as one of the
3534 users from the <quote>write list</quote> as defined in &smb.conf; for
3535 <smbconfsection name="[print$]"/>.
3540 <title>(Optional) Check if Samba knows a driver for the printer.</title>
3543 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3544 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3546 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \
3547 | grep driver </userinput>
3550 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \
3551 | grep -C4 driv</userinput>
3552 servername:[\\kde-bitshop]
3553 printername:[\\kde-bitshop\mysmbtstprn]
3554 sharename:[mysmbtstprn]
3555 portname:[Samba Printer Port]
3557 comment:[mysmbtstprn]
3560 printprocessor:[winprint]
3562 &rootprompt;<userinput>rpcclient -U root%xxxx -c 'getdriver mysmbtstprn' localhost</userinput>
3563 result was WERR_UNKNOWN_PRINTER_DRIVER
3568 None of the three commands shown above should show a driver.
3569 This step was done for the purpose of demonstrating this condition. An
3570 attempt to connect to the printer at this stage will prompt the
3571 message along the lines of: <quote>The server does not have the required printer
3572 driver installed.</quote>
3577 <title>Put all required driver files into Samba's
3581 &rootprompt;<userinput>smbclient //localhost/print\$ -U 'root%xxxx' \
3583 put /etc/cups/ppd/mysmbtstprn.ppd mysmbtstprn.PPD; \
3584 put /usr/share/cups/drivers/cupsui.dll cupsui.dll; \
3585 put /usr/share/cups/drivers/cupsdrvr.dll cupsdrvr.dll; \
3586 put /usr/share/cups/drivers/cups.hlp cups.hlp'</userinput>
3590 (This command should be entered in one long single
3591 line. Line-breaks and the line-end indicated by <quote>\</quote> have been inserted
3592 for readability reasons.) This step is <emphasis>required</emphasis>
3593 for the next one to succeed. It makes the driver files physically
3594 present in the <smbconfsection name="[print$]"/> share. However, clients
3595 would still not be able to install them, because Samba does not yet
3596 treat them as driver files. A client asking for the driver would still
3597 be presented with a <quote>not installed here</quote> message.
3602 <title>Verify where the driver files are now.</title>
3605 &rootprompt;<userinput>ls -l /etc/samba/drivers/W32X86/</userinput>
3607 drwxr-sr-x 2 root ntadmin 532 May 25 23:08 2
3608 drwxr-sr-x 2 root ntadmin 670 May 16 03:15 3
3609 -rwxr--r-- 1 root ntadmin 14234 May 25 23:21 cups.hlp
3610 -rwxr--r-- 1 root ntadmin 278380 May 25 23:21 cupsdrvr.dll
3611 -rwxr--r-- 1 root ntadmin 215848 May 25 23:21 cupsui.dll
3612 -rwxr--r-- 1 root ntadmin 169458 May 25 23:21 mysmbtstprn.PPD
3616 The driver files now are in the W32X86 architecture <quote>root</quote> of
3617 <smbconfsection name="[print$]"/>.
3622 <title>Tell Samba that these are driver files (<command>adddriver</command>).</title>
3625 <indexterm><primary>rpcclient</primary><secondary>adddriver</secondary></indexterm>
3627 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" \
3628 "mydrivername:cupsdrvr.dll:mysmbtstprn.PPD: \
3629 cupsui.dll:cups.hlp:NULL:RAW:NULL"' \
3630 localhost</userinput>
3631 Printer Driver mydrivername successfully installed.
3635 You cannot repeat this step if it fails. It could fail even
3636 as a result of a simple typo. It will most likely have moved a part of
3637 the driver files into the <quote>2</quote> subdirectory. If this step fails, you
3638 need to go back to the fourth step and repeat it before you can try
3639 this one again. In this step, you need to choose a name for your
3640 driver. It is normally a good idea to use the same name as is used for
3641 the printer name; however, in big installations you may use this driver
3642 for a number of printers that obviously have different names, so the
3643 name of the driver is not fixed.
3648 <title>Verify where the driver files are now.</title>
3651 &rootprompt;<userinput>ls -l /etc/samba/drivers/W32X86/</userinput>
3653 drwxr-sr-x 2 root ntadmin 532 May 25 23:22 2
3654 drwxr-sr-x 2 root ntadmin 670 May 16 03:15 3
3656 &rootprompt;<userinput>ls -l /etc/samba/drivers/W32X86/2</userinput>
3659 -rwxr--r-- 1 root ntadmin 14234 May 25 23:21 cups.hlp
3660 -rwxr--r-- 1 root ntadmin 278380 May 13 13:53 cupsdrvr.dll
3661 -rwxr--r-- 1 root ntadmin 215848 May 13 13:53 cupsui.dll
3662 -rwxr--r-- 1 root ntadmin 169458 May 25 23:21 mysmbtstprn.PPD
3666 Notice how step 6 also moved the driver files to the appropriate
3667 subdirectory. Compare this with the situation after step 5.
3672 <title>(Optional) Verify if Samba now recognizes the driver.</title>
3675 <indexterm><primary>rpcclient</primary><secondary>enumdrivers</secondary></indexterm>
3677 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'enumdrivers 3' \
3678 localhost | grep -B2 -A5 mydrivername</userinput>
3679 Printer Driver Info 3:
3681 Driver Name: [mydrivername]
3682 Architecture: [Windows NT x86]
3683 Driver Path: [\\kde-bitshop\print$\W32X86\2\cupsdrvr.dll]
3684 Datafile: [\\kde-bitshop\print$\W32X86\2\mysmbtstprn.PPD]
3685 Configfile: [\\kde-bitshop\print$\W32X86\2\cupsui.dll]
3686 Helpfile: [\\kde-bitshop\print$\W32X86\2\cups.hlp]
3690 Remember, this command greps for the name you chose for the
3691 driver in step 6. This command must succeed before you can proceed.
3696 <para>Tell Samba which printer should use these driver files (<command>setdriver</command>).</para>
3700 <indexterm><primary>rpcclient</primary><secondary>setdriver</secondary></indexterm>
3702 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'setdriver mysmbtstprn mydrivername' \
3703 localhost</userinput>
3704 Successfully set mysmbtstprn to driver mydrivername
3708 Since you can bind any printername (print queue) to any driver, this
3709 is a convenient way to setup many queues that use the same
3710 driver. You do not need to repeat all the previous steps for the
3711 setdriver command to succeed. The only preconditions are:
3712 <command>enumdrivers</command> must find the driver and
3713 <command>enumprinters</command> must find the printer.
3718 <title>(Optional) Verify if Samba has recognized this association.</title>
3721 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3722 <indexterm><primary>rpcclient</primary><secondary>getdriver</secondary></indexterm>
3723 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3725 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \
3726 | grep driver</userinput>
3727 drivername:[mydrivername]
3729 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \
3730 | grep -C4 driv</userinput>
3731 servername:[\\kde-bitshop]
3732 printername:[\\kde-bitshop\mysmbtstprn]
3733 sharename:[mysmbtstprn]
3735 drivername:[mydrivername]
3736 comment:[mysmbtstprn]
3739 printprocessor:[winprint]
3741 &rootprompt;<userinput>rpcclient -U root%xxxx -c 'getdriver mysmbtstprn' localhost</userinput>
3743 Printer Driver Info 3:
3745 Driver Name: [mydrivername]
3746 Architecture: [Windows NT x86]
3747 Driver Path: [\\kde-bitshop\print$\W32X86\2\cupsdrvr.dll]
3748 Datafile: [\\kde-bitshop\print$\W32X86\2\mysmbtstprn.PPD]
3749 Configfile: [\\kde-bitshop\print$\W32X86\2\cupsui.dll]
3750 Helpfile: [\\kde-bitshop\print$\W32X86\2\cups.hlp]
3752 Defaultdatatype: [RAW]
3754 Defaultdatatype: [RAW]
3756 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'enumprinters' localhost \
3757 | grep mysmbtstprn</userinput>
3758 name:[\\kde-bitshop\mysmbtstprn]
3759 description:[\\kde-bitshop\mysmbtstprn,mydrivername,mysmbtstprn]
3760 comment:[mysmbtstprn]
3765 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3766 Compare these results with the ones from steps 2 and 3. Every one of these commands show the driver is installed. Even
3767 the <command>enumprinters</command> command now lists the driver
3768 on the <quote>description</quote> line.
3773 <title>(Optional) Tickle the driver into a correct
3774 device mode.</title>
3777 <indexterm><primary>"Printers" folder</primary></indexterm>
3778 You certainly know how to install the driver on the client. In case
3779 you are not particularly familiar with Windows, here is a short
3780 recipe: Browse the Network Neighborhood, go to the Samba server, and look
3781 for the shares. You should see all shared Samba printers.
3782 Double-click on the one in question. The driver should get
3783 installed and the network connection set up. An alternate way is to
3784 open the <guilabel>Printers (and Faxes)</guilabel> folder, right-click on the printer in
3785 question and select <guilabel>Connect</guilabel> or <guilabel>Install</guilabel>. As a result, a new printer
3786 should have appeared in your client's local <guilabel>Printers (and Faxes)</guilabel>
3787 folder, named something like <guilabel>printersharename on Sambahostname</guilabel>.
3791 It is important that you execute this step as a Samba printer admin
3792 (as defined in &smb.conf;). Here is another method
3793 to do this on Windows XP. It uses a command line, which you may type
3794 into the <quote>DOS box</quote> (type root's smbpassword when prompted):
3798 &dosprompt;<userinput>runas /netonly /user:root "rundll32 printui.dll,PrintUIEntry \
3799 /in /n \\sambaserver\mysmbtstprn"</userinput>
3803 Change any printer setting once (like changing <emphasis><guilabel>portrait</guilabel> to
3804 <guilabel>landscape</guilabel></emphasis>), click on <guibutton>Apply</guibutton>; change the setting
3810 <title>Install the printer on a client
3811 (Point'n'Print).</title>
3815 <indexterm significance="preferred"><primary>point 'n' print</primary></indexterm>
3817 &dosprompt;<userinput>rundll32 printui.dll,PrintUIEntry /in /n "\\sambaserver\mysmbtstprn"</userinput>
3821 If it does not work it could be a permission problem with the
3822 <smbconfsection name="[print$]"/> share.
3827 <title>(Optional) Print a test page.</title>
3830 &dosprompt;<userinput>rundll32 printui.dll,PrintUIEntry /p /n "\\sambaserver\mysmbtstprn"</userinput>
3834 Then hit [TAB] five times, [ENTER] twice, [TAB] once and [ENTER] again
3835 and march to the printer.
3840 <title>(Recommended) Study the test page.</title>
3843 Hmmm.... just kidding! By now you know everything about printer
3844 installations and you do not need to read a word. Just put it in a
3845 frame and bolt it to the wall with the heading "MY FIRST
3846 RPCCLIENT-INSTALLED PRINTER" &smbmdash; why not just throw it away!
3851 <title>(Obligatory) Enjoy. Jump. Celebrate your
3855 &rootprompt;<userinput>echo "Cheeeeerioooooo! Success..." >> /var/log/samba/log.smbd</userinput>
3862 <title>Troubleshooting Revisited</title>
3865 The setdriver command will fail, if in Samba's mind the queue is not
3866 already there. You had promising messages about the:
3870 Printer Driver ABC successfully installed.
3874 after the <command>adddriver</command> parts of the procedure? But you are also seeing
3875 a disappointing message like this one?
3878 <para><computeroutput>
3879 result was NT_STATUS_UNSUCCESSFUL
3880 </computeroutput></para>
3883 <indexterm><primary>lpstat</primary></indexterm>
3884 It is not good enough that you
3885 can see the queue in CUPS, using
3886 the <command>lpstat -p ir85wm</command> command. A
3887 bug in most recent versions of Samba prevents the proper update of
3888 the queue-list. The recognition of newly installed CUPS printers
3889 fails unless you restart Samba or send a HUP to all smbd
3890 processes. To verify if this is the reason why Samba does not
3891 execute the <command>setdriver</command> command successfully, check if Samba <quote>sees</quote>
3896 <indexterm><primary>rpcclient</primary><secondary>enumprinters</secondary></indexterm>
3898 &rootprompt;<userinput>rpcclient transmeta -N -U'root%xxxx' -c 'enumprinters 0'|grep ir85wm</userinput>
3899 printername:[ir85wm]
3903 An alternate command could be this:
3907 <indexterm><primary>rpcclient</primary><secondary>getprinter</secondary></indexterm>
3909 &rootprompt;<userinput>rpcclient transmeta -N -U'root%secret' -c 'getprinter ir85wm' </userinput>
3910 cmd = getprinter ir85wm
3912 name:[\\transmeta\ir85wm]
3913 description:[\\transmeta\ir85wm,ir85wm,DPD]
3914 comment:[CUPS PostScript-Treiber for Windows NT/200x/XP]
3918 By the way, you can use these commands, plus a few more, of course,
3919 to install drivers on remote Windows NT print servers too!
3925 <title>The Printing <filename>*.tdb</filename> Files</title>
3928 <indexterm><primary>TDB</primary></indexterm>
3929 <indexterm><primary>connections.tdb</primary><seealso>TDB</seealso></indexterm>
3930 <indexterm><primary>printing.tdb</primary><seealso>TDB</seealso></indexterm>
3931 <indexterm><primary>share_info.tdb</primary><seealso>TDB</seealso></indexterm>
3932 <indexterm><primary>ntdrivers.tdb</primary><seealso>TDB</seealso></indexterm>
3933 <indexterm><primary>unexpected.tdb</primary><seealso>TDB</seealso></indexterm>
3934 <indexterm><primary>brlock.tdb</primary><seealso>TDB</seealso></indexterm>
3935 <indexterm><primary>locking.tdb</primary><seealso>TDB</seealso></indexterm>
3936 <indexterm><primary>ntforms.tdb</primary><seealso>TDB</seealso></indexterm>
3937 <indexterm><primary>messages.tdb</primary><seealso>TDB</seealso></indexterm>
3938 <indexterm><primary>ntprinters.tdb</primary><seealso>TDB</seealso></indexterm>
3939 <indexterm><primary>sessionid.tdb</primary><seealso>TDB</seealso></indexterm>
3940 <indexterm><primary>secrets.tdb</primary><seealso>TDB</seealso></indexterm>
3941 Some mystery is associated with the series of files with a
3942 tdb suffix appearing in every Samba installation. They are
3943 <filename>connections.tdb</filename>,
3944 <filename>printing.tdb</filename>,
3945 <filename>share_info.tdb</filename>,
3946 <filename>ntdrivers.tdb</filename>,
3947 <filename>unexpected.tdb</filename>,
3948 <filename>brlock.tdb</filename>,
3949 <filename>locking.tdb</filename>,
3950 <filename>ntforms.tdb</filename>,
3951 <filename>messages.tdb</filename> ,
3952 <filename>ntprinters.tdb</filename>,
3953 <filename>sessionid.tdb</filename> and
3954 <filename>secrets.tdb</filename>. What is their purpose?
3958 <title>Trivial Database Files</title>
3961 <indexterm><primary>TDB</primary></indexterm>
3962 A Windows NT (print) server keeps track of all information needed to serve
3963 its duty toward its clients by storing entries in the Windows
3964 registry. Client queries are answered by reading from the registry,
3965 Administrator or user configuration settings that are saved by writing into
3966 the registry. Samba and UNIX obviously do not have such a
3967 Registry. Samba instead keeps track of all client related information in a
3968 series of <filename>*.tdb</filename> files. (TDB = Trivial Data
3969 Base). These are often located in <filename>/var/lib/samba/</filename>
3970 or <filename>/var/lock/samba/</filename>. The printing related files
3971 are <filename>ntprinters.tdb</filename>,
3972 <filename>printing.tdb</filename>,<filename>ntforms.tdb</filename> and
3973 <filename>ntdrivers.tdb</filename>.
3978 <title>Binary Format</title>
3981 <filename>*.tdb</filename> files are not human readable. They are
3982 written in a binary format. <quote>Why not ASCII?</quote>, you may ask. <quote>After all,
3983 ASCII configuration files are a good and proven tradition on UNIX.</quote>
3984 The reason for this design decision by the Samba team is mainly
3985 performance. Samba needs to be fast; it runs a separate
3986 <command>smbd</command> process for each client connection, in some
3987 environments many thousands of them. Some of these smbds might need to
3988 write-access the same <filename>*.tdb</filename> file <emphasis>at the
3989 same time</emphasis>. The file format of Samba's
3990 <filename>*.tdb</filename> files allows for this provision. Many smbd
3991 processes may write to the same <filename>*.tdb</filename> file at the
3992 same time. This wouldn't be possible with pure ASCII files.
3997 <title>Losing <filename>*.tdb</filename> Files</title>
4000 It is very important that all <filename>*.tdb</filename> files remain
4001 consistent over all write and read accesses. However, it may happen
4002 that these files <emphasis>do</emphasis> get corrupted. (A
4003 <command>kill -9 `pidof smbd'</command> while a write access is in
4004 progress could do the damage as well as a power interruption,
4005 etc.). In cases of trouble, a deletion of the old printing-related
4006 <filename>*.tdb</filename> files may be the only option. After that you need to
4007 re-create all print-related setup or you have made a
4008 backup of the <filename>*.tdb</filename> files in time.
4013 <title>Using <command>tdbbackup</command></title>
4017 <indexterm><primary>TDB</primary><secondary>backing up</secondary><see>tdbbackup</see></indexterm>
4018 <indexterm><primary>tdbbackup</primary></indexterm>
4019 Samba ships with a little utility that helps the root user of your
4020 system to backup your <filename>*.tdb</filename> files. If you run it
4021 with no argument, it prints a usage message:
4025 &rootprompt;<userinput>tdbbackup</userinput>
4026 Usage: tdbbackup [options] <fname...>
4029 -h this help message
4030 -s suffix set the backup suffix
4031 -v verify mode (restore if corrupt)
4036 Here is how I backed up my <filename>printing.tdb</filename> file:
4040 &rootprompt;<userinput>ls</userinput>
4041 . browse.dat locking.tdb ntdrivers.tdb printing.tdb
4042 .. share_info.tdb connections.tdb messages.tdb ntforms.tdb
4043 printing.tdbkp unexpected.tdb brlock.tdb gmon.out namelist.debug
4044 ntprinters.tdb sessionid.tdb
4046 &rootprompt;<userinput>tdbbackup -s .bak printing.tdb</userinput>
4047 printing.tdb : 135 records
4049 &rootprompt;<userinput>ls -l printing.tdb*</userinput>
4050 -rw------- 1 root root 40960 May 2 03:44 printing.tdb
4051 -rw------- 1 root root 40960 May 2 03:44 printing.tdb.bak
4058 <title>CUPS Print Drivers from Linuxprinting.org</title>
4062 <indexterm><primary>Linuxprinting.org</primary></indexterm>
4063 CUPS ships with good support for HP LaserJet-type printers. You can
4064 install the generic driver as follows:
4069 <indexterm><primary>lpadmin</primary></indexterm>
4071 &rootprompt;<userinput>lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -m laserjet.ppd</userinput>
4075 The <option>-m</option> switch will retrieve the
4076 <filename>laserjet.ppd</filename> from the standard repository for
4077 not-yet-installed-PPDs, which CUPS typically stores in
4078 <filename>/usr/share/cups/model</filename>. Alternately, you may use
4079 <option>-P /path/to/your.ppd</option>.
4083 The generic <filename>laserjet.ppd,</filename> however, does not support every special option
4084 for every LaserJet-compatible model. It constitutes a sort of <quote>least common
4085 denominator</quote> of all the models. If for some reason
4086 you must pay for the commercially available ESP Print Pro drivers, your
4087 first move should be to consult the database on the
4088 <ulink noescape="1" url="http://www.linuxprinting.org/printer_list.cgi">Linuxprinting</ulink> web site.
4089 Linuxprinting.org has excellent recommendations about which driver is
4090 best used for each printer. Its database is kept current by the
4091 tireless work of Till Kamppeter from MandrakeSoft, who is also the
4092 principal author of the <command>foomatic-rip</command> utility.
4096 <indexterm><primary>foomatic-rip</primary></indexterm>
4097 The former <command>cupsomatic</command> concept is now being replaced by the new
4099 more powerful <command>foomatic-rip</command>.
4100 <command>cupsomatic</command> is no longer maintained. Here is the new URL
4101 to the <ulink noescape="1" url="http://www.linuxprinting.org/driver_list.cgi">Foomatic-3.0</ulink> database.
4102 If you upgrade to <command>foomatic-rip</command>, remember to also upgrade to the
4103 new-style PPDs for your Foomatic-driven printers. foomatic-rip will
4104 not work with PPDs generated for the old <command>cupsomatic</command>. The new-style
4105 PPDs are 100% compliant to the Adobe PPD specification. They are
4106 also intended to be used by Samba and the cupsaddsmb utility, to
4107 provide the driver files for the Windows clients!
4111 <title>foomatic-rip and Foomatic Explained</title>
4115 <indexterm significance="preferred"><primary>foomatic</primary></indexterm>
4116 <indexterm significance="preferred"><primary>foomatic-rip</primary></indexterm>
4117 Nowadays, most Linux distributions rely on the utilities of Linuxprinting.org
4118 to create their printing-related software (which, by the way, works on all
4119 UNIXes and on Mac OS X or Darwin, too). It is not known as well as it
4120 should be, that it also has a very end-user-friendly interface that
4121 allows for an easy update of drivers and PPDs for all supported
4122 models, all spoolers, all operating systems, and all package formats
4123 (because there is none). Its history goes back a few years.
4127 Recently, Foomatic has achieved the astonishing milestone of <ulink
4128 url="http://www.linuxprinting.org/printer_list.cgi?make=Anyone">1000
4129 listed</ulink> printer models. Linuxprinting.org keeps all the
4130 important facts about printer drivers, supported models and which
4131 options are available for the various driver/printer combinations in
4133 url="http://www.linuxprinting.org/foomatic.html">Foomatic</ulink>
4134 database. Currently there are <ulink
4135 url="http://www.linuxprinting.org/driver_list.cgi">245 drivers</ulink>
4136 in the database. Many drivers support various models, and many models
4137 may be driven by different drivers &smbmdash; its your choice!
4141 <title>690 <quote>Perfect</quote> Printers</title>
4144 At present, there are 690 devices dubbed as working perfectly, 181
4145 mostly, 96 partially, and 46 are paperweights. Keeping in mind
4146 that most of these are non-PostScript models (PostScript printers are
4147 automatically supported by CUPS to perfection, by using
4148 their own manufacturer-provided Windows-PPD), and that a
4149 multi-functional device never qualifies as working perfectly if it
4150 does not also scan and copy and fax under GNU/Linux &smbmdash; then this is a
4151 truly astonishing achievement! Three years ago the number was not
4152 more than 500, and Linux or UNIX printing at the time wasn't
4153 anywhere near the quality it is today.
4158 <title>How the Printing HOWTO Started It All</title>
4161 A few years ago <ulink url="http://www2.picante.com:81/~gtaylor/">Grant Taylor</ulink>
4162 started it all. The roots of today's Linuxprinting.org are in the
4163 first <ulink url="http://www.linuxprinting.org/foomatic2.9/howto/">Linux Printing
4164 HOWTO</ulink> that he authored. As a side-project to this document,
4165 which served many Linux users and Admins to guide their first steps in
4166 this complicated and delicate setup (to a scientist, printing is
4167 <quote>applying a structured deposition of distinct patterns of ink or toner
4168 particles on paper substrates</quote>, he started to
4169 build in a little Postgres database with information about the
4170 hardware and driver zoo that made up Linux printing of the time. This
4171 database became the core component of today's Foomatic collection of
4172 tools and data. In the meantime, it has moved to an XML representation
4178 <title>Foomatic's Strange Name</title>
4182 <indexterm><primary>foomatic</primary></indexterm>
4183 <quote>Why the funny name?</quote> you ask. When it really took off, around spring
4184 2000, CUPS was far less popular than today, and most systems used LPD,
4185 LPRng or even PDQ to print. CUPS shipped with a few generic drivers
4186 (good for a few hundred different printer models). These didn't
4187 support many device-specific options. CUPS also shipped with its own
4188 built-in rasterization filter (<parameter>pstoraster</parameter>, derived from
4189 Ghostscript). On the other hand, CUPS provided brilliant support for
4190 <emphasis>controlling</emphasis> all printer options through
4191 standardized and well-defined PPD files (PostScript Printers
4192 Description files). Plus, CUPS was designed to be easily extensible.
4196 Taylor already had in his database a respectable compilation
4197 of facts about many more printers and the Ghostscript <quote>drivers</quote>
4198 they run with. His idea, to generate PPDs from the database information
4199 and use them to make standard Ghostscript filters work within CUPS,
4200 proved to work very well. It also killed several birds with one
4205 <listitem><para>It made all current and future Ghostscript filter
4206 developments available for CUPS.</para></listitem>
4208 <listitem><para>It made available a lot of additional printer models
4209 to CUPS users (because often the traditional Ghostscript way of
4210 printing was the only one available).</para></listitem>
4212 <listitem><para>It gave all the advanced CUPS options (Web interface,
4213 GUI driver configurations) to users wanting (or needing) to use
4214 Ghostscript filters.</para></listitem>
4219 <title>cupsomatic, pdqomatic, lpdomatic, directomatic</title>
4223 <indexterm><primary>cupsomatic</primary></indexterm>
4224 <indexterm><primary>CUPS-PPD</primary></indexterm>
4225 <indexterm><primary>PPD</primary><secondary>CUPS</secondary><see>CUPS-PPD</see></indexterm>
4226 CUPS worked through a quickly-hacked up filter script named <ulink
4227 url="http://www.linuxprinting.org/download.cgi?filename=cupsomatic&show=0">cupsomatic.</ulink>
4228 cupsomatic ran the printfile through Ghostscript, constructing
4229 automatically the rather complicated command line needed. It just
4230 needed to be copied into the CUPS system to make it work. To
4231 configure the way cupsomatic controls the Ghostscript rendering
4232 process, it needs a CUPS-PPD. This PPD is generated directly from the
4233 contents of the database. For CUPS and the respective printer/filter
4234 combo, another Perl script named CUPS-O-Matic did the PPD
4235 generation. After that was working, Taylor implemented within a few
4236 days a similar thing for two other spoolers. Names chosen for the
4237 config-generator scripts were <ulink
4238 url="http://www.linuxprinting.org/download.cgi?filename=lpdomatic&show=0">PDQ-O-Matic</ulink>
4239 (for PDQ) and <ulink
4240 url="http://www.linuxprinting.org/download.cgi?filename=lpdomatic&show=0">LPD-O-Matic</ulink>
4241 (for &smbmdash; you guessed it &smbmdash; LPD); the configuration here didn't use PPDs
4242 but other spooler-specific files.
4246 From late summer of that year, <ulink url="http://www.linuxprinting.org/till/">Till Kamppeter</ulink>
4247 started to put work into the database. Kamppeter had been newly employed by
4248 <ulink url="http://www.mandrakesoft.com/">MandrakeSoft</ulink> to
4249 convert its printing system over to CUPS, after they had seen his
4250 <ulink url="http://www.fltk.org/">FLTK</ulink>-based <ulink
4251 url="http://cups.sourceforge.net/xpp/">XPP</ulink> (a GUI front-end to
4252 the CUPS lp-command). He added a huge amount of new information and new
4253 printers. He also developed the support for other spoolers, like
4254 <ulink url="http://ppr.sourceforge.net/">PPR</ulink> (via ppromatic),
4255 <ulink url="http://sourceforge.net/projects/lpr/">GNUlpr</ulink> and
4256 <ulink url="http://www.lprng.org/">LPRng</ulink> (both via an extended
4257 lpdomatic) and spooler-less printing (<ulink
4258 url="http://www.linuxprinting.org/download.cgi?filename=directomatic&show=0">directomatic</ulink>).
4262 So, to answer your question: <quote>Foomatic</quote> is the general name for all
4263 the overlapping code and data behind the <quote>*omatic</quote> scripts.
4264 Foomatic, up to versions 2.0.x, required (ugly) Perl data structures
4265 attached to Linuxprinting.org PPDs for CUPS. It had a different
4266 <quote>*omatic</quote> script for every spooler, as well as different printer
4267 configuration files.
4272 <title>The <emphasis>Grand Unification</emphasis> Achieved</title>
4276 <indexterm><primary>foomatic-rip</primary></indexterm>
4277 This has all changed in Foomatic versions 2.9 (beta) and released as
4278 <quote>stable</quote> 3.0. It has now achieved the convergence of all *omatic
4279 scripts and is called the <ulink
4280 url="http://www.linuxprinting.org/foomatic2.9/download.cgi?filename=foomatic-rip&show=0">foomatic-rip.</ulink>
4281 This single script is the unification of the previously different
4282 spooler-specific *omatic scripts. foomatic-rip is used by all the
4283 different spoolers alike and because it can read PPDs (both the
4284 original PostScript printer PPDs and the Linuxprinting.org-generated
4285 ones), all of a sudden all supported spoolers can have the power of
4286 PPDs at their disposal. Users only need to plug foomatic-rip into
4287 their system. For users there is improved media type and source
4288 support &smbmdash; paper sizes and trays are easier to configure.
4292 Also, the New Generation of Linuxprinting.org PPDs no longer contains
4293 Perl data structures. If you are a distro maintainer and have
4294 used the previous version of Foomatic, you may want to give the new
4295 one a spin, but remember to generate a new-version set of PPDs
4297 url="http://www.linuxprinting.org/download/foomatic/foomatic-db-engine-3.0.0beta1.tar.gz">foomatic-db-engine!</ulink>
4298 Individual users just need to generate a single new PPD specific to
4299 their model by <ulink
4300 url="http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/II.Foomatic-User/II.tutorial-handout-foomatic-user.html">following
4301 the steps</ulink> outlined in the Foomatic tutorial or in this chapter. This new development is truly amazing.
4305 foomatic-rip is a very clever wrapper around the need to run
4306 Ghostscript with a different syntax, options, device selections, and/or filters for each different printer
4307 or spooler. At the same time it can read the PPD associated
4308 with a print queue and modify the print job according to the user
4309 selections. Together with this comes the 100% compliance of the new
4310 Foomatic PPDs with the Adobe spec. Some innovative features of
4311 the Foomatic concept may surprise users. It will support custom paper
4312 sizes for many printers and will support printing on media drawn
4313 from different paper trays within the same job (in both cases, even
4314 where there is no support for this from Windows-based vendor printer
4320 <title>Driver Development Outside</title>
4323 Most driver development itself does not happen within
4324 Linuxprinting.org. Drivers are written by independent maintainers.
4325 Linuxprinting.org just pools all the information and stores it in its
4326 database. In addition, it also provides the Foomatic glue to integrate
4327 the many drivers into any modern (or legacy) printing system known to
4332 Speaking of the different driver development groups, most of
4333 the work is currently done in three projects. These are:
4337 <listitem><para><ulink
4338 url="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/">Omni</ulink>
4339 &smbmdash; a free software project by IBM that tries to convert their printer
4340 driver knowledge from good-ol' OS/2 times into a modern, modular,
4341 universal driver architecture for Linux/UNIX (still beta). This
4342 currently supports 437 models.</para></listitem>
4344 <listitem><para><ulink url="http://hpinkjet.sf.net/">HPIJS</ulink> &smbmdash;
4345 a free software project by HP to provide the support for their own
4346 range of models (very mature, printing in most cases is perfect and
4347 provides true photo quality). This currently supports 369
4348 models.</para></listitem>
4350 <listitem><para><ulink
4351 url="http://gimp-print.sf.net/">Gimp-Print</ulink> &smbmdash; a free software
4352 effort, started by Michael Sweet (also lead developer for CUPS), now
4353 directed by Robert Krawitz, which has achieved an amazing level of
4354 photo print quality (many Epson users swear that its quality is
4355 better than the vendor drivers provided by Epson for the Microsoft
4356 platforms). This currently supports 522 models.</para></listitem>
4361 <title>Forums, Downloads, Tutorials, Howtos &smbmdash; also for Mac OS X and Commercial UNIX</title>
4364 Linuxprinting.org today is the one-stop shop to download printer
4365 drivers. Look for printer information and <ulink
4366 url="http://www.linuxprinting.org//kpfeifle/LinuxKongress2002/Tutorial/">tutorials</ulink>
4367 or solve printing problems in its popular <ulink
4368 url="http://www.linuxprinting.org/newsportal/">forums.</ulink> This forum
4369 it's not just for GNU/Linux users, but admins of <ulink
4370 url="http://www.linuxprinting.org/macosx/">commercial UNIX
4371 systems</ulink> are also going there, and the relatively new <ulink
4372 url="http://www.linuxprinting.org/newsportal/thread.php3?name=linuxprinting.macosx.general">Mac
4373 OS X forum</ulink> has turned out to be one of the most frequented
4374 forums after only a few weeks.
4378 Linuxprinting.org and the Foomatic driver wrappers around Ghostscript
4379 are now a standard tool-chain for printing on all the important
4380 distros. Most of them also have CUPS underneath. While in recent years
4381 most printer data had been added by Kamppeter (who works at Mandrake), many
4382 additional contributions came from engineers with SuSE, Red Hat,
4383 Conectiva, Debian, and others. Vendor-neutrality is an important goal
4384 of the Foomatic project.
4388 Till Kamppeter from MandrakeSoft is doing an excellent job in his
4389 spare time to maintain Linuxprinting.org and Foomatic. So if you use
4390 it often, please send him a note showing your appreciation.
4395 <title>Foomatic Database-Generated PPDs</title>
4398 The Foomatic database is an amazing piece of ingenuity in itself. Not
4399 only does it keep the printer and driver information, but it is
4400 organized in a way that it can generate PPD files on the fly from
4401 its internal XML-based datasets. While these PPDs are modeled to the
4402 Adobe specification of PostScript Printer Descriptions (PPDs), the
4403 Linuxprinting.org/Foomatic-PPDs do not normally drive PostScript
4404 printers. They are used to describe all the bells and whistles you
4405 could ring or blow on an Epson Stylus inkjet, or a HP Photosmart, or
4406 what-have-you. The main trick is one little additional line, not
4407 envisaged by the PPD specification, starting with the <parameter>*cupsFilter</parameter>
4408 keyword. It tells the CUPS daemon how to proceed with the PostScript
4409 print file (old-style Foomatic-PPDs named the
4410 cupsomatic filter script, while the new-style
4411 PPDs are now call foomatic-rip). This filter
4412 script calls Ghostscript on the host system (the recommended variant
4413 is ESP Ghostscript) to do the rendering work. foomatic-rip knows which
4414 filter or internal device setting it should ask from Ghostscript to
4415 convert the PostScript print job into a raster format ready for the
4416 target device. This usage of PPDs to describe the options of non-PS
4417 printers was the invention of the CUPS developers. The rest is easy.
4418 GUI tools (like KDE's marvelous <ulink
4419 url="http://printing.kde.org/overview/kprinter.phtml">kprinter,</ulink>
4421 url="http://gtklp.sourceforge.net/">gtklp,</ulink> xpp and the CUPS
4422 Web interface) read the PPD as well and use this information to present
4423 the available settings to the user as an intuitive menu selection.
4429 <title>foomatic-rip and Foomatic-PPD Download and Installation</title>
4432 Here are the steps to install a foomatic-rip driven LaserJet 4 Plus-compatible
4433 printer in CUPS (note that recent distributions of SuSE, UnitedLinux and
4434 Mandrake may ship with a complete package of Foomatic-PPDs plus the
4435 <command>foomatic-rip</command> utility. Going directly to
4436 Linuxprinting.org ensures that you get the latest driver/PPD files):
4440 <listitem><para>Open your browser at the Linuxprinting.org printer list<ulink url="http://www.linuxprinting.org/printer_list.cgi">page.</ulink>
4443 <listitem><para>Check the complete list of printers in the
4444 <ulink url="http://www.linuxprinting.org/printer_list.cgi?make=Anyone">database.</ulink>.
4447 <listitem><para>Select your model and click on the link.
4450 <listitem><para>You'll arrive at a page listing all drivers working with this
4451 model (for all printers, there will always be <emphasis>one</emphasis>
4452 recommended driver. Try this one first).
4455 <listitem><para>In our case (HP LaserJet 4 Plus), we'll arrive at the default driver for the
4456 <ulink url="http://www.linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_4_Plus">HP-LaserJet 4 Plus.</ulink>
4459 <listitem><para>The recommended driver is ljet4.</para></listitem>
4461 <listitem><para>Several links are provided here. You should visit them all if you
4462 are not familiar with the Linuxprinting.org database.
4465 <listitem><para>There is a link to the database page for the
4466 <ulink url="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4">ljet4.</ulink>
4467 On the driver's page, you'll find important and detailed information
4468 about how to use that driver within the various available
4469 spoolers.</para></listitem>
4471 <listitem><para>Another link may lead you to the home-page of the
4472 driver author or the driver.</para></listitem>
4474 <listitem><para>Important links are the ones that provide hints with
4475 setup instructions for <ulink noescape="1" url="http://www.linuxprinting.org/cups-doc.html">CUPS</ulink>,
4476 <ulink url="http://www.linuxprinting.org/pdq-doc.html">PDQ</ulink>,
4477 <ulink url="http://www.linuxprinting.org/lpd-doc.html">LPD, LPRng and GNUlpr</ulink>)
4478 as well as <ulink url="http://www.linuxprinting.org/ppr-doc.html">PPR</ulink>
4479 or <quote>spooler-less</quote> <ulink url="http://www.linuxprinting.org/direct-doc.html">printing.</ulink>
4482 <listitem><para>You can view the PPD in your browser through this link:
4483 <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>
4484 </para></listitem> <listitem><para>Most importantly, you can also generate and download
4485 the <ulink url="http://www.linuxprinting.org/ppd-o-matic.cgi?driver=ljet4&printer=HP-LaserJet_4_Plus&show=0">PPD.</ulink>
4488 <listitem><para>The PPD contains all the information needed to use our
4489 model and the driver; once installed, this works transparently
4490 for the user. Later you'll only need to choose resolution, paper size,
4491 and so on from the Web-based menu, or from the print dialog GUI, or from
4492 the command line.</para></listitem>
4494 <listitem><para>If you ended up on the drivers
4495 <ulink url="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4">page</ulink>
4496 you can choose to use the <quote>PPD-O-Matic</quote> online PPD generator
4497 program.</para></listitem>
4499 <listitem><para>Select the exact model and check either <guilabel>Download</guilabel> or
4500 <guilabel>Display PPD file</guilabel> and click <guilabel>Generate PPD file</guilabel>.</para></listitem>
4502 <listitem><para>If you save the PPD file from the browser view, please
4503 do not use cut and paste (since it could possibly damage line endings
4504 and tabs, which makes the PPD likely to fail its duty), but use <guimenuitem>Save
4505 as...</guimenuitem> in your browsers menu. (It is best to use the <guilabel>Download</guilabel> option
4506 directly from the Web page).</para></listitem>
4508 <listitem><para>Another interesting part on each driver page is
4509 the <guimenuitem>Show execution details</guimenuitem> button. If you
4510 select your printer model and click on that button,
4511 a complete Ghostscript command line will be displayed, enumerating all options
4512 available for that combination of driver and printer model. This is a great way to
4513 <quote>learn Ghostscript by doing</quote>. It is also an excellent cheat sheet
4514 for all experienced users who need to re-construct a good command line
4515 for that damn printing script, but can't remember the exact
4516 syntax. </para></listitem>
4518 <listitem><para>Some time during your visit to Linuxprinting.org, save
4519 the PPD to a suitable place on your hard-disk, say
4520 <filename>/path/to/my-printer.ppd</filename> (if you prefer to install
4521 your printers with the help of the CUPS Web interface, save the PPD to
4522 the <filename>/usr/share/cups/model/</filename> path and restart
4523 cupsd).</para></listitem>
4525 <listitem><para>Then install the printer with a suitable command line,
4530 &rootprompt;<userinput>lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E \
4531 -P path/to/my-printer.ppd</userinput>
4532 </screen></para></listitem>
4534 <listitem><para>For all the new-style <quote>Foomatic-PPDs</quote>
4535 from Linuxprinting.org, you also need a special CUPS filter named
4539 <listitem><para>The foomatic-rip Perl script itself also makes some
4540 interesting <ulink url="http://www.linuxprinting.org/foomatic2.9/download.cgi?filename=foomatic-rip&show=1">reading</ulink>
4541 because it is well documented by Kamppeter's in-line comments (even
4542 non-Perl hackers will learn quite a bit about printing by reading
4543 it).</para></listitem>
4545 <listitem><para>Save foomatic-rip either directly in
4546 <filename>/usr/lib/cups/filter/foomatic-rip</filename> or somewhere in
4547 your $PATH (and remember to make it world-executable). Again,
4548 do not save by copy and paste but use the appropriate link or the
4549 <guimenuitem>Save as...</guimenuitem> menu item in your browser.</para></listitem>
4551 <listitem><para>If you save foomatic-rip in your $PATH, create a symlink:
4553 &rootprompt;<userinput>cd /usr/lib/cups/filter/ ; ln -s `which foomatic-rip'</userinput>
4558 CUPS will discover this new available filter at startup after restarting
4559 cupsd.</para></listitem>
4563 Once you print to a print queue set up with the Foomatic-PPD, CUPS will
4564 insert the appropriate commands and comments into the resulting
4565 PostScript jobfile. foomatic-rip is able to read and act upon
4566 these and uses some specially encoded Foomatic comments
4567 embedded in the jobfile. These in turn are used to construct
4568 (transparently for you, the user) the complicated Ghostscript command
4569 line telling the printer driver exactly how the resulting raster
4570 data should look and which printer commands to embed into the
4571 data stream. You need:
4576 <listitem><para>A <quote>foomatic+something</quote> PPD &smbmdash; but this is not enough
4577 to print with CUPS (it is only <emphasis>one</emphasis> important
4578 component).</para></listitem>
4580 <listitem><para>The <parameter>foomatic-rip</parameter> filter script (Perl) in
4581 <filename>/usr/lib/cups/filters/</filename>.</para></listitem>
4583 <listitem><para>Perl to make foomatic-rip run.</para></listitem>
4585 <listitem><para>Ghostscript (because it is doing the main work,
4586 controlled by the PPD/foomatic-rip combo) to produce the raster data
4587 fit for your printer model's consumption.</para></listitem>
4589 <listitem><para>Ghostscript <emphasis>must</emphasis> (depending on
4590 the driver/model) contain support for a certain device representing
4591 the selected driver for your model (as shown by <command>gs
4592 -h</command>).</para></listitem>
4594 <listitem><para>foomatic-rip needs a new version of PPDs (PPD versions
4595 produced for cupsomatic do not work with
4596 foomatic-rip).</para></listitem>
4602 <title>Page Accounting with CUPS</title>
4606 <indexterm><primary>CUPS</primary><secondary>Page Accounting</secondary></indexterm>
4607 Often there are questions regarding print quotas where Samba users
4608 (that is, Windows clients) should not be able to print beyond a
4609 certain number of pages or data volume per day, week or month. This
4610 feature is dependent on the real print subsystem you're using.
4611 Samba's part is always to receive the job files from the clients
4612 (filtered <emphasis>or</emphasis> unfiltered) and hand it over to this
4617 Of course one could hack things with one's own scripts. But then
4618 there is CUPS. CUPS supports quotas that can be based on the size of
4619 jobs or on the number of pages or both, and span any time
4624 <title>Setting Up Quotas</title>
4627 <indexterm><primary>CUPS</primary><secondary>quotas</secondary></indexterm>
4628 This is an example command of how root would set a print quota in CUPS,
4629 assuming an existing printer named <quote>quotaprinter</quote>:
4634 <indexterm><primary>lpadmin</primary></indexterm>
4636 &rootprompt;<userinput>lpadmin -p quotaprinter -o job-quota-period=604800 \
4637 -o job-k-limit=1024 -o job-page-limit=100</userinput>
4641 This would limit every single user to print 100 pages or 1024 KB of
4642 data (whichever comes first) within the last 604,800 seconds ( = 1
4648 <title>Correct and Incorrect Accounting</title>
4651 For CUPS to count correctly, the printfile needs to pass the CUPS
4652 pstops filter, otherwise it uses a dummy count of <quote>one</quote>. Some
4653 print files do not pass it (e.g., image files) but then those are mostly one-
4654 page jobs anyway. This also means that proprietary drivers for the
4655 target printer running on the client computers and CUPS/Samba, which
4656 then spool these files as <quote>raw</quote> (i.e., leaving them untouched, not
4657 filtering them), will be counted as one-pagers too!
4661 You need to send PostScript from the clients (i.e., run a PostScript
4662 driver there) to have the chance to get accounting done. If the
4663 printer is a non-PostScript model, you need to let CUPS do the job to
4664 convert the file to a print-ready format for the target printer. This
4665 is currently working for about a thousand different printer models.
4666 Linuxprinting has a driver
4667 <ulink url="http://www.linuxprinting.org/printer_list.cgi">list.</ulink>
4672 <title>Adobe and CUPS PostScript Drivers for Windows Clients</title>
4675 Before CUPS 1.1.16, your only option was to use the Adobe PostScript
4676 Driver on the Windows clients. The output of this driver was not
4677 always passed through the <command>pstops</command> filter on the CUPS/Samba side, and
4678 therefore was not counted correctly (the reason is that it often,
4679 depending on the PPD being used, wrote a PJL-header in front of
4680 the real PostScript which caused CUPS to skip <command>pstops</command> and go directly
4681 to the <command>pstoraster</command> stage).
4685 From CUPS 1.1.16 onward, you can use the CUPS PostScript Driver for
4686 Windows <?latex \linebreak ?>NT/200x/XP clients (which is tagged in the download area of
4687 <filename>http://www.cups.org/</filename> as the <filename>cups-samba-1.1.16.tar.gz</filename>
4688 package). It does <emphasis>not</emphasis> work for Windows 9x/ME clients, but it guarantees:
4693 <listitem><para> <indexterm><primary>PJL</primary></indexterm> To not write a PJL-header.</para></listitem>
4695 <listitem><para>To still read and support all PJL-options named in the
4696 driver PPD with its own means.</para></listitem>
4698 <listitem><para>That the file will pass through the <command>pstops</command> filter
4699 on the CUPS/Samba server.</para></listitem>
4701 <listitem><para>To page-count correctly the print file.</para></listitem>
4705 You can read more about the setup of this combination in the man page
4706 for <command>cupsaddsmb</command> (which is only present with CUPS installed, and only
4707 current from CUPS 1.1.16).
4712 <title>The page_log File Syntax</title>
4715 <indexterm><primary>page_log</primary></indexterm>
4716 These are the items CUPS logs in the <filename>page_log</filename> for every
4721 <listitem><para>Printer name</para></listitem>
4723 <listitem><para>User name</para></listitem>
4725 <listitem><para>Job ID</para></listitem>
4727 <listitem><para>Time of printing</para></listitem>
4729 <listitem><para>The page number</para></listitem>
4731 <listitem><para>The number of copies</para></listitem>
4733 <listitem><para>A billing information string (optional)</para></listitem>
4735 <listitem><para>The host that sent the job (included since version 1.1.19)</para></listitem>
4739 Here is an extract of my CUPS server's <filename>page_log</filename> file to illustrate the
4740 format and included items:
4744 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 1 3 #marketing 10.160.50.13
4745 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 2 3 #marketing 10.160.50.13
4746 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 3 3 #marketing 10.160.50.13
4747 tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 4 3 #marketing 10.160.50.13
4748 Dig9110 boss 402 [22/Apr/2003:10:33:22 +0100] 1 440 finance-dep 10.160.51.33
4752 This was job ID <parameter>401</parameter>, printed on <parameter>tec_IS2027</parameter>
4753 by user <parameter>kurt</parameter>, a 64-page job printed in three copies and billed to
4754 <parameter>#marketing</parameter>, sent from IP address <constant>10.160.50.13.</constant>
4755 The next job had ID <parameter>402</parameter>, was sent by user <parameter>boss</parameter>
4756 from IP address <constant>10.160.51.33</constant>, printed from one page 440 copies and
4757 is set to be billed to <parameter>finance-dep</parameter>.
4762 <title>Possible Shortcomings</title>
4765 What flaws or shortcomings are there with this quota system?
4769 <listitem><para>The ones named above (wrongly logged job in case of
4770 printer hardware failure, and so on).</para></listitem>
4772 <listitem><para>In reality, CUPS counts the job pages that are being
4773 processed in <emphasis>software</emphasis> (that is, going through the
4774 RIP) rather than the physical sheets successfully leaving the
4775 printing device. Thus if there is a jam while printing the fifth sheet out
4776 of a thousand and the job is aborted by the printer, the page count will
4777 still show the figure of a thousand for that job.</para></listitem>
4779 <listitem><para>All quotas are the same for all users (no flexibility
4780 to give the boss a higher quota than the clerk) and no support for
4781 groups.</para></listitem>
4783 <listitem><para>No means to read out the current balance or the
4784 <quote>used-up</quote> number of current quota.</para></listitem>
4786 <listitem><para>A user having used up 99 sheets of a 100 quota will
4787 still be able to send and print a thousand sheet job.</para></listitem>
4789 <listitem><para>A user being denied a job because of a filled-up quota
4790 does not get a meaningful error message from CUPS other than
4791 <quote>client-error-not-possible</quote>.</para></listitem>
4796 <title>Future Developments</title>
4799 This is the best system currently available, and there are huge
4800 improvements under development for CUPS 1.2:
4804 <listitem><para>Page counting will go into the backends (these talk
4805 directly to the printer and will increase the count in sync with the
4806 actual printing process; thus, a jam at the fifth sheet will lead to a
4807 stop in the counting).</para></listitem>
4809 <listitem><para>Quotas will be handled more flexibly.</para></listitem>
4811 <listitem><para>Probably there will be support for users to inquire
4812 about their accounts in advance.</para></listitem>
4814 <listitem><para>Probably there will be support for some other tools
4815 around this topic.</para></listitem>
4821 <title>Other Accounting Tools</title>
4824 PrintAnalyzer, pyKota, printbill, LogReport.
4831 <title>Additional Material</title>
4834 A printer queue with <emphasis>no</emphasis> PPD associated to it is a
4835 <quote>raw</quote> printer and all files will go directly there as received by the
4836 spooler. The exceptions are file types <parameter>application/octet-stream</parameter>
4837 that need pass-through feature enabled. <quote>Raw</quote> queues do not do any
4838 filtering at all, they hand the file directly to the CUPS backend.
4839 This backend is responsible for sending the data to the device
4840 (as in the <quote>device URI</quote> notation: <filename>lpd://, socket://,
4841 smb://, ipp://, http://, parallel:/, serial:/, usb:/</filename>, and so on).
4845 cupsomatic/Foomatic are <emphasis>not</emphasis> native CUPS drivers
4846 and they do not ship with CUPS. They are a third party add-on
4847 developed at Linuxprinting.org. As such, they are a brilliant hack to
4848 make all models (driven by Ghostscript drivers/filters in traditional
4849 spoolers) also work via CUPS, with the same (good or bad!) quality as
4850 in these other spoolers. <parameter>cupsomatic</parameter> is only a vehicle to execute a
4851 Ghostscript command-line at that stage in the CUPS filtering chain,
4852 where normally the native CUPS <parameter>pstoraster</parameter> filter would kick
4853 in. cupsomatic bypasses pstoraster, kidnaps the printfile from CUPS
4854 away and redirects it to go through Ghostscript. CUPS accepts this,
4855 because the associated cupsomatic/foomatic-PPD specifies:
4858 *cupsFilter: "application/vnd.cups-postscript 0 cupsomatic"
4861 This line persuades CUPS to hand the file to cupsomatic, once it has
4862 successfully converted it to the MIME type
4863 <parameter>application/vnd.cups-postscript</parameter>. This conversion will not happen for
4864 Jobs arriving from Windows that are auto-typed
4865 <parameter>application/octet-stream</parameter>, with the according changes in
4866 <filename>/etc/cups/mime.types</filename> in place.
4870 CUPS is widely configurable and flexible, even regarding its filtering
4871 mechanism. Another workaround in some situations would be to have in
4872 <filename>/etc/cups/mime.types</filename> entries as follows:
4875 application/postscript application/vnd.cups-raw 0 -
4876 application/vnd.cups-postscript application/vnd.cups-raw 0 -
4879 This would prevent all PostScript files from being filtered (rather,
4880 they will through the virtual <emphasis>nullfilter</emphasis>
4881 denoted with <quote>-</quote>). This could only be useful for PS printers. If you
4882 want to print PS code on non-PS printers (provided they support ASCII
4883 text printing), an entry as follows could be useful:
4886 */* application/vnd.cups-raw 0 -
4889 and would effectively send <emphasis>all</emphasis> files to the
4890 backend without further processing.
4894 You could have the following entry:
4897 application/vnd.cups-postscript application/vnd.cups-raw 0 \
4898 my_PJL_stripping_filter
4901 You will need to write a <parameter>my_PJL_stripping_filter</parameter>
4902 (which could be a shell script) that parses the PostScript and removes the
4903 unwanted PJL. This needs to conform to CUPS filter design
4904 (mainly, receive and pass the parameters printername, job-id,
4905 username, jobtitle, copies, print options and possibly the
4906 filename). It is installed as world executable into
4907 <filename>/usr/lib/cups/filters/</filename> and is called by CUPS
4908 if it encounters a MIME type <parameter>application/vnd.cups-postscript</parameter>.
4912 CUPS can handle <parameter>-o job-hold-until=indefinite</parameter>.
4913 This keeps the job in the queue on hold. It will only be printed
4914 upon manual release by the printer operator. This is a requirement in
4915 many central reproduction departments, where a few operators manage
4916 the jobs of hundreds of users on some big machine, where no user is
4917 allowed to have direct access (such as when the operators often need
4918 to load the proper paper type before running the 10,000 page job
4919 requested by marketing for the mailing, and so on).
4924 <title>Auto-Deletion or Preservation of CUPS Spool Files</title>
4927 Samba print files pass through two spool directories. One is the
4928 incoming directory managed by Samba, (set in the
4929 <smbconfoption name="path">/var/spool/samba</smbconfoption>
4930 directive in the <smbconfsection name="[printers]"/> section of
4931 &smb.conf;). The other is the spool directory of
4932 your UNIX print subsystem. For CUPS it is normally
4933 <filename>/var/spool/cups/</filename>, as set by the <filename>cupsd.conf</filename>
4934 directive <filename>RequestRoot /var/spool/cups</filename>.
4938 <title>CUPS Configuration Settings Explained</title>
4941 Some important parameter settings in the CUPS configuration file
4942 <filename>cupsd.conf</filename> are:
4947 <varlistentry><term>PreserveJobHistory Yes</term>
4949 This keeps some details of jobs in cupsd's mind (well it keeps the
4950 c12345, c12346, and so on, files in the CUPS spool directory, which do a
4951 similar job as the old-fashioned BSD-LPD control files). This is set
4952 to <quote>Yes</quote> as a default.
4953 </para></listitem></varlistentry>
4955 <varlistentry><term>PreserveJobFiles Yes</term>
4957 This keeps the job files themselves in cupsd's mind
4958 (it keeps the d12345, d12346 etc. files in the CUPS spool
4959 directory). This is set to <quote>No</quote> as the CUPS
4961 </para></listitem></varlistentry>
4963 <varlistentry><term><emphasis><quote>MaxJobs 500</quote></emphasis></term>
4965 This directive controls the maximum number of jobs
4966 that are kept in memory. Once the number of jobs reaches the limit,
4967 the oldest completed job is automatically purged from the system to
4968 make room for the new one. If all of the known jobs are still
4969 pending or active, then the new job will be rejected. Setting the
4970 maximum to 0 disables this functionality. The default setting is
4972 </para></listitem></varlistentry>
4976 (There are also additional settings for <parameter>MaxJobsPerUser</parameter> and
4977 <parameter>MaxJobsPerPrinter</parameter>...)
4982 <title>Pre-Conditions</title>
4985 For everything to work as announced, you need to have three
4990 <listitem><para>A Samba-smbd that is compiled against <filename>libcups</filename> (check
4991 on Linux by running <userinput>ldd `which smbd'</userinput>).</para></listitem>
4993 <listitem><para>A Samba-&smb.conf; setting of
4994 <smbconfoption name="printing">cups</smbconfoption>.</para></listitem>
4996 <listitem><para>Another Samba-&smb.conf; setting of
4997 <smbconfoption name="printcap">cups</smbconfoption>.</para></listitem>
5001 In this case, all other manually set printing-related commands (like
5002 <smbconfoption name="print command"/>,
5003 <smbconfoption name="lpq command"/>,
5004 <smbconfoption name="lprm command"/>,
5005 <smbconfoption name="lppause command"/> or
5006 <smbconfoption name="lpresume command"/>) are ignored and they should normally have no
5007 influence whatsoever on your printing.
5012 <title>Manual Configuration</title>
5015 If you want to do things manually, replace the <smbconfoption name="printing">cups</smbconfoption>
5016 by <smbconfoption name="printing">bsd</smbconfoption>. Then your manually set commands may work
5017 (I haven't tested this), and a <smbconfoption name="print command">lp -d %P %s; rm %s"</smbconfoption>
5018 may do what you need.
5024 <title>Printing from CUPS to Windows Attached Printers</title>
5027 >From time to time the question arises, how can you print
5028 <emphasis>to</emphasis> a Windows attached printer
5029 <emphasis>from</emphasis> Samba? Normally the local connection
5030 from Windows host to printer would be done by USB or parallel
5031 cable, but this does not matter to Samba. From here only an SMB
5032 connection needs to be opened to the Windows host. Of course, this
5033 printer must be shared first. As you have learned by now, CUPS uses
5034 <emphasis>backends</emphasis> to talk to printers and other
5035 servers. To talk to Windows shared printers, you need to use the
5036 <filename>smb</filename> (surprise, surprise!) backend. Check if this
5037 is in the CUPS backend directory. This usually resides in
5038 <filename>/usr/lib/cups/backend/</filename>. You need to find an <filename>smb</filename>
5039 file there. It should be a symlink to <filename>smbspool</filename>
5040 and the file must exist and be executable:
5044 &rootprompt;<userinput>ls -l /usr/lib/cups/backend/</userinput>
5046 drwxr-xr-x 3 root root 720 Apr 30 19:04 .
5047 drwxr-xr-x 6 root root 125 Dec 19 17:13 ..
5048 -rwxr-xr-x 1 root root 10692 Feb 16 21:29 canon
5049 -rwxr-xr-x 1 root root 10692 Feb 16 21:29 epson
5050 lrwxrwxrwx 1 root root 3 Apr 17 22:50 http -> ipp
5051 -rwxr-xr-x 1 root root 17316 Apr 17 22:50 ipp
5052 -rwxr-xr-x 1 root root 15420 Apr 20 17:01 lpd
5053 -rwxr-xr-x 1 root root 8656 Apr 20 17:01 parallel
5054 -rwxr-xr-x 1 root root 2162 Mar 31 23:15 pdfdistiller
5055 lrwxrwxrwx 1 root root 25 Apr 30 19:04 ptal -> /usr/sbin/ptal-cups
5056 -rwxr-xr-x 1 root root 6284 Apr 20 17:01 scsi
5057 lrwxrwxrwx 1 root root 17 Apr 2 03:11 smb -> /usr/bin/smbspool
5058 -rwxr-xr-x 1 root root 7912 Apr 20 17:01 socket
5059 -rwxr-xr-x 1 root root 9012 Apr 20 17:01 usb
5061 &rootprompt;<userinput>ls -l `which smbspool`</userinput>
5062 -rwxr-xr-x 1 root root 563245 Dec 28 14:49 /usr/bin/smbspool
5066 If this symlink does not exist, create it:
5070 &rootprompt;<userinput>ln -s `which smbspool` /usr/lib/cups/backend/smb</userinput>
5074 <command>smbspool</command> has been written by Mike Sweet from the CUPS folks. It is
5075 included and ships with Samba. It may also be used with print
5076 subsystems other than CUPS, to spool jobs to Windows printer shares. To
5077 set up printer <replaceable>winprinter</replaceable> on CUPS, you need to have a driver for
5078 it. Essentially this means to convert the print data on the CUPS/Samba
5079 host to a format that the printer can digest (the Windows host is
5080 unable to convert any files you may send). This also means you should
5081 be able to print to the printer if it were hooked directly at your
5082 Samba/CUPS host. For troubleshooting purposes, this is what you
5083 should do to determine if that part of the process chain is in
5084 order. Then proceed to fix the network connection/authentication to
5085 the Windows host, and so on.
5089 To install a printer with the <parameter>smb</parameter> backend on CUPS, use this command:
5093 &rootprompt;<userinput>lpadmin -p winprinter -v smb://WINDOWSNETBIOSNAME/printersharename \
5094 -P /path/to/PPD</userinput>
5098 The PPD must be able to direct CUPS to generate
5099 the print data for the target model. For PostScript printers, just use
5100 the PPD that would be used with the Windows NT PostScript driver. But
5101 what can you do if the printer is only accessible with a password? Or
5102 if the printer's host is part of another workgroup? This is provided
5103 for: You can include the required parameters as part of the
5104 <filename>smb://</filename> device-URI like this:
5108 <listitem><para><filename>smb://WORKGROUP/WINDOWSNETBIOSNAME/printersharename</filename></para></listitem>
5109 <listitem><para><filename>smb://username:password@WORKGROUP/WINDOWSNETBIOSNAME/printersharename</filename></para></listitem>
5110 <listitem><para><filename>smb://username:password@WINDOWSNETBIOSNAME/printersharename</filename></para></listitem>
5114 Note that the device-URI will be visible in the process list of the
5115 Samba server (e.g., when someone uses the <command>ps -aux</command>
5116 command on Linux), even if the username and passwords are sanitized
5117 before they get written into the log files. So this is an inherently
5118 insecure option, however, it is the only one. Don't use it if you want
5119 to protect your passwords. Better share the printer in a way that
5120 does not require a password! Printing will only work if you have a
5121 working netbios name resolution up and running. Note that this is a
5122 feature of CUPS and you do not necessarily need to have smbd running.
5128 <title>More CUPS-Filtering Chains</title>
5131 The following diagrams reveal how CUPS handles print jobs.
5135 <imagedescription>Filtering chain 1.</imagedescription>
5136 <imagefile>cups1</imagefile>
5140 <imagedescription>Filtering chain with cupsomatic</imagedescription>
5141 <imagefile>cups2</imagefile>
5147 <title>Common Errors</title>
5150 <title>Windows 9x/ME Client Can't Install Driver</title>
5152 <para>For Windows 9x/ME, clients require the printer names to be eight
5153 characters (or <quote>8 plus 3 chars suffix</quote>) max; otherwise, the driver files
5154 will not get transferred when you want to download them from
5159 <sect2 id="root-ask-loop">
5160 <title><quote>cupsaddsmb</quote> Keeps Asking for Root Password in Never-ending Loop</title>
5162 <para>Have you <smbconfoption name="security">user</smbconfoption>? Have
5163 you used <command>smbpasswd</command> to give root a Samba account?
5164 You can do two things: open another terminal and execute
5165 <command>smbpasswd -a root</command> to create the account and
5166 continue entering the password into the first terminal. Or break
5167 out of the loop by pressing ENTER twice (without trying to type a
5171 If the error is: <quote>tree connect failed: NT_STATUS_BAD_NETWORK_NAME</quote>,
5172 you may have forgotten to create the <filename>/etc/samba/drivers</filename> directory.
5177 <title><quote>cupsaddsmb</quote> or <quote>rpcclient addriver</quote> Keeps Giving WERR_BAD_PASSWORD</title>
5179 <para>See <link linkend="root-ask-loop">the previous common error</link>.</para>
5183 <title><quote>cupsaddsmb</quote> Errors</title>
5186 The use of <quote>cupsaddsmb</quote> gives <quote>No PPD file for printer...</quote>
5187 Message While PPD File Is Present. What might the problem be?
5190 <para>Have you enabled printer sharing on CUPS? This means:
5191 Do you have a <parameter><Location
5192 /printers>....</Location></parameter> section in CUPS
5193 server's <filename>cupsd.conf</filename> that does not deny access to
5194 the host you run <quote>cupsaddsmb</quote> from? It <emphasis>could</emphasis> be
5195 an issue if you use cupsaddsmb remotely, or if you use it with a
5196 <option>-h</option> parameter: <userinput>cupsaddsmb -H
5197 sambaserver -h cupsserver -v printername</userinput>.
5200 <para>Is your <parameter>TempDir</parameter> directive in
5201 <filename>cupsd.conf</filename> set to a valid value and is it writable?
5207 <title>Client Can't Connect to Samba Printer</title>
5209 <para>Use <command>smbstatus</command> to check which user
5210 you are from Samba's point of view. Do you have the privileges to
5211 write into the <smbconfsection name="[print$]"/>
5217 <title>New Account Reconnection from Windows 200x/XP Troubles</title>
5219 <para>Once you are connected as the wrong user (for
5220 example, as <constant>nobody</constant>, which often occurs if you have
5221 <smbconfoption name="map to guest">bad user</smbconfoption>), Windows Explorer will not accept an
5222 attempt to connect again as a different user. There will not be any byte
5223 transfered on the wire to Samba, but still you'll see a stupid error
5224 message that makes you think Samba has denied access. Use
5225 <command>smbstatus</command> to check for active connections. Kill the
5226 PIDs. You still can't re-connect and you get the dreaded
5227 <computeroutput>You can't connect with a second account from the same
5228 machine</computeroutput> message, as soon as you are trying. And you
5229 do not see any single byte arriving at Samba (see logs; use <quote>ethereal</quote>)
5230 indicating a renewed connection attempt. Shut all Explorer Windows.
5231 This makes Windows forget what it has cached in its memory as
5232 established connections. Then reconnect as the right user. The best
5233 method is to use a DOS terminal window and <emphasis>first</emphasis>
5234 do <userinput>net use z: \\&example.server.samba;\print$ /user:root</userinput>. Check
5235 with <command>smbstatus</command> that you are connected under a
5236 different account. Now open the <guilabel>Printers</guilabel> folder (on the Samba server
5237 in the <guilabel>Network Neighborhood</guilabel>), right-click on the
5238 printer in question and select
5239 <guibutton>Connect...</guibutton></para></sect2>
5242 <title>Avoid Being Connected to the Samba Server as the Wrong User</title>
5244 <para>You see per <command>smbstatus</command> that you are
5245 connected as user nobody; while you want to be root or
5246 printer admin. This is probably due to
5247 <smbconfoption name="map to guest">bad user</smbconfoption>, which silently connects you under the guest account
5248 when you gave (maybe by accident) an incorrect username. Remove
5249 <smbconfoption name="map to guest"/>, if you want to prevent
5250 this.</para></sect2>
5253 <title>Upgrading to CUPS Drivers from Adobe Drivers</title>
5256 This information came from a mailing list posting regarding problems experienced when
5257 upgrading from Adobe drivers to CUPS drivers on Microsoft Windows NT/200x/XP Clients.
5260 <para>First delete all old Adobe-using printers. Then
5261 delete all old Adobe drivers. (On Windows 200x/XP, right-click in
5262 the background of <guilabel>Printers</guilabel> folder, select <guimenuitem>Server Properties...</guimenuitem>, select
5263 tab <guilabel>Drivers</guilabel> and delete here).</para></sect2>
5265 <sect2><title>Can't Use <quote>cupsaddsmb</quote> on Samba Server Which Is a PDC</title>
5266 <para>Do you use the <quote>naked</quote> root user name? Try to do it
5267 this way: <userinput>cupsaddsmb -U <replaceable>DOMAINNAME</replaceable>\\root -v
5268 <replaceable>printername</replaceable></userinput>> (note the two backslashes: the first one is
5269 required to <quote>escape</quote> the second one).</para></sect2>
5271 <sect2><title>Deleted Windows 200x Printer Driver Is Still Shown</title>
5272 <para>Deleting a printer on the client will not delete the
5273 driver too (to verify, right-click on the white background of the
5274 <guilabel>Printers</guilabel> folder, select <guimenuitem>Server Properties</guimenuitem> and click on the
5275 <guilabel>Drivers</guilabel> tab). These same old drivers will be re-used when you try to
5276 install a printer with the same name. If you want to update to a new
5277 driver, delete the old ones first. Deletion is only possible if no
5278 other printer uses the same driver.</para></sect2>
5280 <sect2><title>Windows 200x/XP "Local Security Policies"</title>
5281 <para>Local Security Policies may not
5282 allow the installation of unsigned drivers. <quote>Local Security Policies</quote>
5283 may not allow the installation of printer drivers at
5286 <sect2><title>Administrator Cannot Install Printers for All Local Users</title>
5287 <para>Windows XP handles SMB printers on a <quote>per-user</quote> basis.
5288 This means every user needs to install the printer himself. To have a
5289 printer available for everybody, you might want to use the built-in
5290 IPP client capabilities of Win XP. Add a printer with the print path of
5291 <parameter>http://cupsserver:631/printers/printername</parameter>.
5292 We're still looking into this one. Maybe a logon script could
5293 automatically install printers for all
5294 users.</para></sect2>
5296 <sect2><title>Print Change Notify Functions on NT-clients</title>
5297 <para>For print change, notify functions on NT++ clients.
5298 These need to run the <command>Server</command> service first (renamed to
5299 <command>File & Print Sharing for MS Networks</command> in
5303 <title>Win XP-SP1</title>
5305 <para>Win XP-SP1 introduced a Point and Print Restriction Policy (this restriction does not apply to
5306 <quote>Administrator</quote> or <quote>Power User</quote> groups of users). In Group Policy
5307 Object Editor, go to <guimenu>User Configuration -> Administrative Templates ->
5308 Control Panel -> Printers</guimenu>. The policy is automatically set to
5309 <constant>Enabled</constant> and the <constant>Users can only Point
5310 and Print to machines in their Forest</constant> . You probably need
5311 to change it to <constant>Disabled</constant> or <constant>Users can
5312 only Point and Print to these servers</constant> to make
5313 driver downloads from Samba possible.
5318 <title>Print Options for All Users Can't Be Set on Windows 200x/XP</title>
5320 <para>How are you doing it? I bet the wrong way (it is not
5321 easy to find out, though). There are three different ways to bring
5322 you to a dialog that <emphasis>seems</emphasis> to set everything. All
5323 three dialogs <emphasis>look</emphasis> the same, yet only one of them
5324 does what you intend. You need to be
5325 Administrator or Print Administrator to do this for all users. Here
5326 is how I do in on XP:
5329 <orderedlist numeration="upperalpha">
5331 <listitem><para>The first wrong way:
5334 <listitem><para>Open the <guilabel>Printers</guilabel>
5335 folder.</para></listitem>
5337 <listitem><para>Right-click on the printer
5338 (<guilabel>remoteprinter on cupshost</guilabel>) and
5339 select in context menu <guimenuitem>Printing
5340 Preferences...</guimenuitem></para></listitem>
5342 <listitem><para>Look at this dialog closely and remember what it looks
5343 like.</para></listitem>
5348 <listitem><para>The second wrong way:
5351 <listitem><para>Open the <guilabel>Printers</guilabel>
5352 folder.</para></listitem>
5354 <listitem><para>Right-click on the printer (<guilabel>remoteprinter on
5355 cupshost</guilabel>) and select the context menu
5356 <guimenuitem>Properties</guimenuitem>.</para></listitem>
5358 <listitem><para>Click on the <guilabel>General</guilabel>
5359 tab.</para></listitem>
5361 <listitem><para>Click on the button <guibutton>Printing
5362 Preferences...</guibutton></para></listitem>
5364 <listitem><para>A new dialog opens. Keep this dialog open and go back
5365 to the parent dialog.</para></listitem>
5370 <listitem><para>The third, and the correct way:
5374 <listitem><para>Open the <guilabel>Printers</guilabel>
5375 folder.</para></listitem>
5377 <listitem><para>Click on the <guilabel>Advanced</guilabel>
5378 tab. (If everything is <quote>grayed out,</quote> then you are not logged
5379 in as a user with enough privileges).</para></listitem>
5381 <listitem><para>Click on the <guibutton>Printing
5382 Defaults...</guibutton> button.</para></listitem>
5384 <listitem><para>On any of the two new tabs, click on the
5385 <guibutton>Advanced...</guibutton>
5386 button.</para></listitem>
5388 <listitem><para>A new dialog opens. Compare this one to the other
5389 identical looking one from <quote>B.5</quote> or A.3".</para></listitem>
5396 Do you see any difference? I don't either. However, only the last
5397 one, which you arrived at with steps <quote>C.1.-6.</quote>, will save any settings
5398 permanently and be the defaults for new users. If you want all clients
5399 to get the same defaults, you need to conduct these steps <emphasis>as
5400 Administrator</emphasis> (<smbconfoption name="printer admin"/> in
5401 &smb.conf;) <emphasis>before</emphasis> a client
5402 downloads the driver (the clients can later set their own
5403 <emphasis>per-user defaults</emphasis> by following the
5404 procedures <emphasis>A</emphasis> or <emphasis>B</emphasis>
5405 above).</para></sect2>
5407 <sect2><title>Most Common Blunders in Driver Settings on Windows Clients</title>
5408 <para>Don't use <parameter>Optimize for
5409 Speed</parameter>, but use <parameter>Optimize for
5410 Portability</parameter> instead (Adobe PS Driver). Don't use
5411 <parameter>Page Independence: No</parameter>: always
5412 settle with <parameter>Page Independence:
5413 Yes</parameter> (Microsoft PS Driver and CUPS PS Driver for
5414 Windows NT/200x/XP). If there are problems with fonts, use
5415 <parameter>Download as Softfont into
5416 printer</parameter> (Adobe PS Driver). For
5417 <guilabel>TrueType Download Options</guilabel>
5418 choose <constant>Outline</constant>. Use PostScript
5419 Level 2, if you are having trouble with a non-PS printer and if
5420 there is a choice.</para></sect2>
5422 <sect2><title><command>cupsaddsmb</command> Does Not Work with Newly Installed Printer</title>
5423 <para>Symptom: The last command of
5424 <command>cupsaddsmb</command> does not complete successfully:
5425 <command>cmd = setdriver printername printername</command> result was
5426 NT_STATUS_UNSUCCESSFUL then possibly the printer was not yet
5427 recognized by Samba. Did it show up in Network
5428 Neighborhood? Did it show up i n <command>rpcclient
5429 hostname -c `enumprinters'</command>? Restart smbd (or send a
5430 <command>kill -HUP</command> to all processes listed by
5431 <command>smbstatus</command> and try
5432 again.</para></sect2>
5435 <title>Permissions on <filename>/var/spool/samba/</filename> Get Reset After Each Reboot</title>
5436 <para>Have you ever by accident set the CUPS spool directory to
5437 the same location? (<parameter>RequestRoot /var/spool/samba/</parameter> in <filename>cupsd.conf</filename> or
5438 the other way round: <filename>/var/spool/cups/</filename> is set as
5439 <smbconfoption name="path"/>> in the <smbconfsection name="[printers]"/>
5440 section). These <parameter>must</parameter> be different. Set
5442 <parameter>RequestRoot /var/spool/cups/</parameter> in
5443 <filename>cupsd.conf</filename> and <smbconfoption name="path">
5444 /var/spool/samba</smbconfoption> in the <smbconfsection name="[printers]"/>
5445 section of &smb.conf;. Otherwise cupsd will
5446 sanitize permissions to its spool directory with each restart and
5447 printing will not work reliably.</para></sect2>
5450 <title>Print Queue Called <quote>lp</quote> Mis-handles Print Jobs</title>
5453 In this case a print queue called <quote>lp</quote> intermittently swallows jobs and
5454 spits out completely different ones from what was sent.
5457 <para>It is a bad idea to name any printer <quote>lp</quote>. This
5458 is the traditional UNIX name for the default printer. CUPS may be set
5459 up to do an automatic creation of Implicit Classes. This means, to
5460 group all printers with the same name to a pool of devices, and
5461 load-balancing the jobs across them in a round-robin fashion. Chances
5462 are high that someone else has a printer named <quote>lp</quote> too. You may
5463 receive his jobs and send your own to his device unwittingly. To have
5464 tight control over the printer names, set <parameter>BrowseShortNames
5465 No</parameter>. It will present any printer as <replaceable>printername@cupshost</replaceable>
5466 and then gives you better control over what may happen in a large
5467 networked environment.</para></sect2>
5469 <sect2><title>Location of Adobe PostScript Driver Files for <quote>cupsaddsmb</quote></title>
5470 <para>Use <command>smbclient</command> to connect to any
5471 Windows box with a shared PostScript printer: <command>smbclient
5472 //windowsbox/print\$ -U guest</command>. You can navigate to the
5473 <filename>W32X86/2</filename> subdir to <command>mget ADOBE*</command>
5474 and other files or to <filename>WIN40/0</filename> to do the same.
5475 Another option is to download the <filename>*.exe</filename> packaged
5476 files from the Adobe Web site.</para></sect2>
5481 <title>Overview of the CUPS Printing Processes</title>
5483 <para>A complete overview of the CUPS printing processes can be found in <link linkend="a_small">the next flowchart</link>.</para>
5485 <image id="a_small">
5486 <imagedescription>CUPS printing overview.</imagedescription>
5487 <imagefile>a_small</imagefile>