1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter�22.�CUPS Printing Support</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.0"><link rel="start" href="index.html" title="The Official Samba-3 HOWTO and Reference Guide"><link rel="up" href="optional.html" title="Part�III.�Advanced Configuration"><link rel="prev" href="classicalprinting.html" title="Chapter�21.�Classical Printing Support"><link rel="next" href="VFS.html" title="Chapter�23.�Stackable VFS modules"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter�22.�CUPS Printing Support</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="classicalprinting.html">Prev</a>�</td><th width="60%" align="center">Part�III.�Advanced Configuration</th><td width="20%" align="right">�<a accesskey="n" href="VFS.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="CUPS-printing"></a>Chapter�22.�CUPS Printing Support</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Kurt</span> <span class="surname">Pfeifle</span></h3><div class="affiliation"><span class="orgname">Danka Deutschland GmbH <br></span><div class="address"><p><code class="email"><<a href="mailto:kpfeifle@danka.de">kpfeifle@danka.de</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Ciprian</span> <span class="surname">Vizitiu</span></h3><span class="contrib">drawings</span><div class="affiliation"><div class="address"><p><code class="email"><<a href="mailto:CVizitiu@gbif.org">CVizitiu@gbif.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Jelmer</span> <span class="othername">R.</span> <span class="surname">Vernooij</span></h3><span class="contrib">drawings</span><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><code class="email"><<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>></code></p></div></div></div></div><div><p class="pubdate"> (27 Jan 2004) </p></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="CUPS-printing.html#id392883">Introduction</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id392889">Features and Benefits</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id392940">Overview</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id393049">Basic CUPS Support Configuration</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id393149">Linking smbd with libcups.so</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id393337">Simple <code class="filename">smb.conf</code> Settings for CUPS</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id393584">More Complex CUPS <code class="filename">smb.conf</code> Settings</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id393980">Advanced Configuration</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id393994">Central Spooling vs. “<span class="quote">Peer-to-Peer</span>” Printing</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id394045">Raw Print Serving: Vendor Drivers on Windows Clients</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id394249">Installation of Windows Client Drivers</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#cups-raw">Explicitly Enable “<span class="quote">raw</span>” Printing for <span class="emphasis"><em>application/octet-stream</em></span></a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id394512">Driver Upload Methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id394623">Advanced Intelligent Printing with PostScript Driver Download</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#gdipost">GDI on Windows, PostScript on UNIX</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id394797">Windows Drivers, GDI, and EMF</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id394963">UNIX Printfile Conversion and GUI Basics</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#post-and-ghost">PostScript and Ghostscript</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id395287">Ghostscript: The Software RIP for Non-PostScript Printers</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id395426">PostScript Printer Description (PPD) Specification</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id395495">Using Windows-Formatted Vendor PPDs</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id395604">CUPS Also Uses PPDs for Non-PostScript Printers</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id395639">The CUPS Filtering Architecture</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id395860">MIME Types and CUPS Filters</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id396270">MIME Type Conversion Rules</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id396465">Filtering Overview</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id396616">Prefilters</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id396793">pstops</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id396952">pstoraster</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id397202">imagetops and imagetoraster</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id397282">rasterto [printers specific]</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id397494">CUPS Backends</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id397802">The Role of <em class="parameter"><code>cupsomatic/foomatic</code></em></a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id398021">The Complete Picture</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id398033"><code class="filename">mime.convs</code></a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id398094">“<span class="quote">Raw</span>” Printing</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id398194">application/octet-stream Printing</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id398455">PostScript Printer Descriptions for Non-PostScript Printers</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id398718"><span class="emphasis"><em>cupsomatic/foomatic-rip</em></span> Versus <span class="emphasis"><em>Native CUPS</em></span> Printing</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id399033">Examples for Filtering Chains</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id399434">Sources of CUPS Drivers/PPDs</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id399543">Printing with Interface Scripts</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id399622">Network Printing (Purely Windows)</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id399636">From Windows Clients to an NT Print Server</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id399694">Driver Execution on the Client</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id399759">Driver Execution on the Server</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id399858">Network Printing (Windows Clients and UNIX/Samba Print 2Servers)</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id399874">From Windows Clients to a CUPS/Samba Print Server</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id400039">Samba Receiving Job-Files and Passing Them to CUPS</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id400108">Network PostScript RIP</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id400187">PPDs for Non-PS Printers on UNIX</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id400224">PPDs for Non-PS Printers on Windows</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id400285">Windows Terminal Servers (WTS) as CUPS Clients</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id400296">Printer Drivers Running in “<span class="quote">Kernel Mode</span>” Cause Many 3Problems</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id400328">Workarounds Impose Heavy Limitations</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id400341">CUPS: A “<span class="quote">Magical Stone</span>”?</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id400378">PostScript Drivers with No Major Problems, Even in Kernel 4Mode</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id400456">Configuring CUPS for Driver Download</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id400475"><span class="emphasis"><em>cupsaddsmb</em></span>: The Unknown Utility</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id400563">Prepare Your <code class="filename">smb.conf</code> for <code class="literal">cupsaddsmb</code></a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id400868">CUPS “<span class="quote">PostScript Driver for Windows NT/200x/XP</span>”</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id401090">Recognizing Different Driver Files</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id401201">Acquiring the Adobe Driver Files</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id401221">ESP Print Pro PostScript Driver for Windows NT/200x/XP</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id401275">Caveats to Be Considered</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id401555">Windows CUPS PostScript Driver Versus Adobe Driver</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id401750">Run cupsaddsmb (Quiet Mode)</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id401880">Run cupsaddsmb with Verbose Output</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id402011">Understanding cupsaddsmb</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id402147">How to Recognize If cupsaddsmb Completed Successfully</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id402254">cupsaddsmb with a Samba PDC</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id402332">cupsaddsmb Flowchart</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id402410">Installing the PostScript Driver on a Client</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#cups-avoidps1">Avoiding Critical PostScript Driver Settings on the Client</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id402619">Installing PostScript Driver Files Manually Using rpcclient</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id402785">A Check of the rpcclient man Page</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id402945">Understanding the rpcclient man Page</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id403037">Producing an Example by Querying a Windows Box</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id403163">Requirements for adddriver and setdriver to Succeed</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id403371">Manual Driver Installation in 15 Steps</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id404250">Troubleshooting Revisited</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id404381">The Printing <code class="filename">*.tdb</code> Files</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id404580">Trivial Database Files</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id404646">Binary Format</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id404707">Losing <code class="filename">*.tdb</code> Files</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id404753">Using <code class="literal">tdbbackup</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id404864">CUPS Print Drivers from Linuxprinting.org</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id405024">foomatic-rip and Foomatic Explained</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id405729">foomatic-rip and Foomatic PPD Download and Installation</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id406151">Page Accounting with CUPS</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id406181">Setting Up Quotas</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id406232">Correct and Incorrect Accounting</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id406265">Adobe and CUPS PostScript Drivers for Windows Clients</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id406396">The page_log File Syntax</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id406532">Possible Shortcomings</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id406590">Future Developments</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id406625">Other Accounting Tools</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id406637">Additional Material</a></span></dt><dt><span class="sect1"><a href="CUPS-printing.html#id406826">Autodeletion or Preservation of CUPS Spool Files</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id406894">CUPS Configuration Settings Explained</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id406971">Preconditions</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407077">Manual Configuration</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id407111">Printing from CUPS to Windows-Attached Printers</a></span></dt><dt><span class="sect1"><a href="CUPS-printing.html#id407368">More CUPS Filtering Chains</a></span></dt><dt><span class="sect1"><a href="CUPS-printing.html#id407477">Common Errors</a></span></dt><dd><dl><dt><span class="sect2"><a href="CUPS-printing.html#id407482">Windows 9x/Me Client Can't Install Driver</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#root-ask-loop">“<span class="quote">cupsaddsmb</span>” Keeps Asking for Root Password in Never-ending Loop</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407549">“<span class="quote">cupsaddsmb</span>” or “<span class="quote">rpcclient addriver</span>” Emit Error</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407585">“<span class="quote">cupsaddsmb</span>” Errors</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407655">Client Can't Connect to Samba Printer</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407678">New Account Reconnection from Windows 200x/XP Troubles</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407756">Avoid Being Connected to the Samba Server as the Wrong User</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407795">Upgrading to CUPS Drivers from Adobe Drivers</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407830">Can't Use “<span class="quote">cupsaddsmb</span>” on Samba Server, Which Is a PDC</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407864">Deleted Windows 200x Printer Driver Is Still Shown</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407895">Windows 200x/XP Local Security Policies</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407926">Administrator Cannot Install Printers for All Local Users</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407963">Print Change, Notify Functions on NT Clients</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id407987">Win XP-SP1</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id408028">Print Options for All Users Can't Be Set on Windows 200x/XP</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id408292">Most Common Blunders in Driver Settings on Windows Clients</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id408345"><code class="literal">cupsaddsmb</code> Does Not Work with Newly Installed Printer</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id408391">Permissions on <code class="filename">/var/spool/samba/</code> Get Reset After Each Reboot</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id408477">Print Queue Called “<span class="quote">lp</span>” Mishandles Print Jobs</a></span></dt><dt><span class="sect2"><a href="CUPS-printing.html#id408540">Location of Adobe PostScript Driver Files for “<span class="quote">cupsaddsmb</span>”</a></span></dt></dl></dd><dt><span class="sect1"><a href="CUPS-printing.html#id408591">Overview of the CUPS Printing Processes</a></span></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id392883"></a>Introduction</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id392889"></a>Features and Benefits</h3></div></div></div><p> 5<a class="indexterm" name="id392897"></a> 6 The Common UNIX Print System (<a href="http://www.cups.org/" target="_top">CUPS</a>) 7 has become quite popular. All major Linux distributions now ship it as their default printing 8 system. To many, it is still a mystical tool. Mostly, it just works. People tend to regard 9 it as a “<span class="quote">black box</span>” that they do not want to look into as long as it works. But once 10 there is a little problem, they have trouble finding out where to start debugging it. Refer to 11 <a href="classicalprinting.html" title="Chapter�21.�Classical Printing Support">Classical Printing</a>, which contains much information 12 that is also relevant to CUPS. 13 </p><p> 14<a class="indexterm" name="id392927"></a> 15 CUPS sports quite a few unique and powerful features. While its basic functions may be grasped quite 16 easily, they are also new. Because it is different from other, more traditional printing systems, it is best 17 not to try to apply any prior knowledge about printing to this new system. Rather, try to understand CUPS from 18 the beginning. This documentation will lead you to a complete understanding of CUPS. Let's start with the most 19 basic things first. 20 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id392940"></a>Overview</h3></div></div></div><p> 21<a class="indexterm" name="id392948"></a> 22<a class="indexterm" name="id392954"></a> 23<a class="indexterm" name="id392961"></a> 24<a class="indexterm" name="id392968"></a> 25<a class="indexterm" name="id392975"></a> 26<a class="indexterm" name="id392984"></a> 27<a class="indexterm" name="id392994"></a> 28<a class="indexterm" name="id393000"></a> 29 CUPS is more than just a print spooling system. It is a complete printer management system that 30 complies with the new Internet Printing Protocol (IPP). IPP is an industry and Internet Engineering Task Force 31 (IETF) standard for network printing. Many of its functions can be managed remotely (or locally) via a Web 32 browser (giving you platform-independent access to the CUPS print server). Additionally, it has the 33 traditional command line and several more modern GUI interfaces (GUI interfaces developed by third parties, 34 like KDE's overwhelming <a href="http://printing.kde.org/" target="_top">KDEPrint</a>). 35 </p><p> 36<a class="indexterm" name="id393021"></a> 37<a class="indexterm" name="id393028"></a> 38 CUPS allows creation of <span class="emphasis"><em>raw</em></span> printers (i.e., no print file format translation) as 39 well as <span class="emphasis"><em>smart</em></span> printers (i.e., CUPS does file format conversion as required for the 40 printer). In many ways, this gives CUPS capabilities similar to the MS Windows print monitoring system. Of 41 course, if you are a CUPS advocate, you would argue that CUPS is better! In any case, let us now explore how 42 to configure CUPS for interfacing with MS Windows print clients via Samba. 43 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id393049"></a>Basic CUPS Support Configuration</h2></div></div></div><p> 44<a class="indexterm" name="id393057"></a> 45<a class="indexterm" name="id393063"></a> 46<a class="indexterm" name="id393070"></a> 47<a class="indexterm" name="id393077"></a> 48<a class="indexterm" name="id393084"></a> 49Printing with CUPS in the most basic <code class="filename">smb.conf</code> setup in Samba-3.0 (as was true for 2.2.x) requires just two 50parameters: <a class="indexterm" name="id393098"></a>printing = cups and <a class="indexterm" name="id393105"></a>printcap = cups. CUPS does not need a printcap file. However, the 51<code class="filename">cupsd.conf</code> configuration file knows of two related directives that control how such a 52file will be automatically created and maintained by CUPS for the convenience of third-party applications 53(example: <em class="parameter"><code>Printcap /etc/printcap</code></em> and <em class="parameter"><code>PrintcapFormat BSD</code></em>). 54Legacy programs often require the existence of a printcap file containing printer names or they will refuse to 55print. Make sure CUPS is set to generate and maintain a printcap file. For details, see <code class="literal">man 56cupsd.conf</code> and other CUPS-related documentation, like the wealth of documents regarding the CUPS 57server itself available from the <a href="http://localhost:631/documentation.html" target="_top">CUPS</a> web site. 58 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id393149"></a>Linking smbd with libcups.so</h3></div></div></div><p> 59<a class="indexterm" name="id393157"></a> 60 Samba has a special relationship to CUPS. Samba can be compiled with CUPS library support. 61 Most recent installations have this support enabled. By default, CUPS linking is compiled 62 into smbd and other Samba binaries. Of course, you can use CUPS even 63 if Samba is not linked against <code class="filename">libcups.so</code> but 64 there are some differences in required or supported configuration. 65 </p><p> 66<a class="indexterm" name="id393179"></a> 67<a class="indexterm" name="id393186"></a> 68 When Samba is compiled and linked with <code class="filename">libcups</code>, <a class="indexterm" name="id393198"></a>printcap = cups 69 uses the CUPS API to list printers, submit jobs, query queues, and so on. Otherwise it maps to the System V 70 commands with an additional <code class="literal">-oraw</code> option for printing. On a Linux 71 system, you can use the <code class="literal">ldd</code> utility to find out if smbd has been linked with the 72 libcups library (<code class="literal">ldd</code> may not be present on other OS platforms, or its function may be embodied 73 by a different command): 74</p><pre class="screen"> 75<code class="prompt">root# </code><strong class="userinput"><code>ldd `which smbd`</code></strong> 76libssl.so.0.9.6 => /usr/lib/libssl.so.0.9.6 (0x4002d000) 77libcrypto.so.0.9.6 => /usr/lib/libcrypto.so.0.9.6 (0x4005a000) 78libcups.so.2 => /usr/lib/libcups.so.2 (0x40123000) 79[....] 80</pre><p> 81 </p><p> 82<a class="indexterm" name="id393246"></a> 83 The line <code class="computeroutput">libcups.so.2 => /usr/lib/libcups.so.2 (0x40123000)</code> shows 84 there is CUPS support compiled into this version of Samba. If this is the case, and printing = cups 85 is set, then <span class="emphasis"><em>any otherwise manually set print command in <code class="filename">smb.conf</code> is ignored</em></span>. 86 This is an important point to remember! 87 </p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p> Should it be necessary, for any reason, to set your own print commands, you can do this by setting 88 <a class="indexterm" name="id393277"></a>printing = sysv. However, you will lose all the benefits 89 of tight CUPS-Samba integration. When you do this, you must manually configure the printing system commands 90 (most important: 91 <a class="indexterm" name="id393285"></a>print command; other commands are 92 <a class="indexterm" name="id393293"></a>lppause command, 93 <a class="indexterm" name="id393300"></a>lpresume command, 94 <a class="indexterm" name="id393307"></a>lpq command, 95 <a class="indexterm" name="id393314"></a>lprm command, 96 <a class="indexterm" name="id393321"></a>queuepause command and 97 <a class="indexterm" name="id393328"></a>queue resume command). 98 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id393337"></a>Simple <code class="filename">smb.conf</code> Settings for CUPS</h3></div></div></div><p> 99 To summarize, <a href="CUPS-printing.html#cups-exam-simple" title="Example�22.1.�Simplest Printing-Related smb.conf">the Simplest Printing-Related 100 <code class="filename">smb.conf</code> file</a> shows the simplest printing-related setup for <code class="filename">smb.conf</code> to 101 enable basic CUPS support: 102 </p><div class="example"><a name="cups-exam-simple"></a><p class="title"><b>Example�22.1.�Simplest Printing-Related smb.conf</b></p><div class="example-contents"><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id393397"></a><em class="parameter"><code>load printers = yes</code></em></td></tr><tr><td><a class="indexterm" name="id393410"></a><em class="parameter"><code>printing = cups</code></em></td></tr><tr><td><a class="indexterm" name="id393422"></a><em class="parameter"><code>printcap name = cups</code></em></td></tr><tr><td> </td></tr><tr><td><em class="parameter"><code>[printers]</code></em></td></tr><tr><td><a class="indexterm" name="id393444"></a><em class="parameter"><code>comment = All Printers</code></em></td></tr><tr><td><a class="indexterm" name="id393456"></a><em class="parameter"><code>path = /var/spool/samba</code></em></td></tr><tr><td><a class="indexterm" name="id393469"></a><em class="parameter"><code>browseable = no</code></em></td></tr><tr><td><a class="indexterm" name="id393481"></a><em class="parameter"><code>public = yes</code></em></td></tr><tr><td><a class="indexterm" name="id393494"></a><em class="parameter"><code>guest ok = yes</code></em></td></tr><tr><td><a class="indexterm" name="id393506"></a><em class="parameter"><code>writable = no</code></em></td></tr><tr><td><a class="indexterm" name="id393519"></a><em class="parameter"><code>printable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id393531"></a><em class="parameter"><code>printer admin = root, @ntadmins</code></em></td></tr></table></div></div><br class="example-break"><p> 103<a class="indexterm" name="id393547"></a> 104<a class="indexterm" name="id393554"></a> 105<a class="indexterm" name="id393561"></a> 106 This is all you need for basic printing setup for CUPS. It will print all graphic, text, PDF, and PostScript 107 files submitted from Windows clients. However, most of your Windows users would not know how to send these 108 kinds of files to print without opening a GUI application. Windows clients tend to have local printer drivers 109 installed, and the GUI application's print buttons start a printer driver. Your users also rarely send files 110 from the command line. Unlike UNIX clients, they rarely submit graphic, text, or PDF formatted files directly 111 to the spooler. They nearly exclusively print from GUI applications with a “<span class="quote">printer driver</span>” 112 hooked between the application's native format and the print data stream. If the backend printer is not a 113 PostScript device, the print data stream is “<span class="quote">binary,</span>” sensible only for the target printer. Read 114 on to learn what problem this may cause and how to avoid it. 115 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id393584"></a>More Complex CUPS <code class="filename">smb.conf</code> Settings</h3></div></div></div><p> 116 <a href="CUPS-printing.html#overridesettings" title="Example�22.2.�Overriding Global CUPS Settings for One Printer">The Overriding Global CUPS Settings for One Printer example</a> 117 is a slightly more complex printing-related setup for <code class="filename">smb.conf</code>. It enables general CUPS printing 118 support for all printers, but defines one printer share, which is set up differently. 119 </p><div class="example"><a name="overridesettings"></a><p class="title"><b>Example�22.2.�Overriding Global CUPS Settings for One Printer</b></p><div class="example-contents"><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id393638"></a><em class="parameter"><code>printing = cups</code></em></td></tr><tr><td><a class="indexterm" name="id393651"></a><em class="parameter"><code>printcap name = cups</code></em></td></tr><tr><td><a class="indexterm" name="id393663"></a><em class="parameter"><code>load printers = yes</code></em></td></tr><tr><td> </td></tr><tr><td><em class="parameter"><code>[printers]</code></em></td></tr><tr><td><a class="indexterm" name="id393685"></a><em class="parameter"><code>comment = All Printers</code></em></td></tr><tr><td><a class="indexterm" name="id393697"></a><em class="parameter"><code>path = /var/spool/samba</code></em></td></tr><tr><td><a class="indexterm" name="id393710"></a><em class="parameter"><code>public = yes</code></em></td></tr><tr><td><a class="indexterm" name="id393722"></a><em class="parameter"><code>guest ok = yes</code></em></td></tr><tr><td><a class="indexterm" name="id393735"></a><em class="parameter"><code>writable = no</code></em></td></tr><tr><td><a class="indexterm" name="id393747"></a><em class="parameter"><code>printable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id393760"></a><em class="parameter"><code>printer admin = root, @ntadmins</code></em></td></tr><tr><td> </td></tr><tr><td><em class="parameter"><code>[special_printer]</code></em></td></tr><tr><td><a class="indexterm" name="id393781"></a><em class="parameter"><code>comment = A special printer with his own settings</code></em></td></tr><tr><td><a class="indexterm" name="id393794"></a><em class="parameter"><code>path = /var/spool/samba-special</code></em></td></tr><tr><td><a class="indexterm" name="id393807"></a><em class="parameter"><code>printing = sysv</code></em></td></tr><tr><td><a class="indexterm" name="id393819"></a><em class="parameter"><code>printcap = lpstat</code></em></td></tr><tr><td><a class="indexterm" name="id393832"></a><em class="parameter"><code>print command = echo "NEW: `date`: printfile %f" >> /tmp/smbprn.log ; echo " `date`: p-%p s-%s f-%f" >> /tmp/smbprn.log ; echo " `date`: j-%j J-%J z-%z c-%c" >> /tmp/smbprn.log ; rm %f </code></em></td></tr><tr><td><a class="indexterm" name="id393847"></a><em class="parameter"><code>public = no</code></em></td></tr><tr><td><a class="indexterm" name="id393859"></a><em class="parameter"><code>guest ok = no</code></em></td></tr><tr><td><a class="indexterm" name="id393872"></a><em class="parameter"><code>writable = no</code></em></td></tr><tr><td><a class="indexterm" name="id393884"></a><em class="parameter"><code>printable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id393897"></a><em class="parameter"><code>printer admin = kurt</code></em></td></tr><tr><td><a class="indexterm" name="id393910"></a><em class="parameter"><code>hosts deny = 0.0.0.0</code></em></td></tr><tr><td><a class="indexterm" name="id393922"></a><em class="parameter"><code>hosts allow = turbo_xp, 10.160.50.23, 10.160.51.60</code></em></td></tr></table></div></div><br class="example-break"><p> 120 This special share is only for testing purposes. It does not write the print job to a file. It just logs the job parameters 121 known to Samba into the <code class="filename">/tmp/smbprn.log</code> file and deletes the job-file. Moreover, the 122 <a class="indexterm" name="id393946"></a>printer admin of this share is “<span class="quote">kurt</span>” (not the “<span class="quote">@ntadmins</span>” group), 123 guest access is not allowed, the share isn't published to the Network Neighborhood (so you need to know it is there), and it 124 allows access from only three hosts. To prevent CUPS from kicking in and taking over the print jobs for that share, we need to set 125 <a class="indexterm" name="id393962"></a>printing = sysv and <a class="indexterm" name="id393970"></a>printcap = lpstat. 126 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id393980"></a>Advanced Configuration</h2></div></div></div><p> 127 Before we delve into all the configuration options, let us clarify a few points. <span class="emphasis"><em>Network printing 128 needs to be organized and set up correctly</em></span>. This frequently doesn't happen. Legacy systems or small 129 business LAN environments often lack design and good housekeeping. 130 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id393994"></a>Central Spooling vs. “<span class="quote">Peer-to-Peer</span>” Printing</h3></div></div></div><p> 131<a class="indexterm" name="id394006"></a> 132 <a class="indexterm" name="id394013"></a> 133 <a class="indexterm" name="id394022"></a> 134 Many small office or home networks, as well as badly organized larger environments, allow each client a direct 135 access to available network printers. This is generally a bad idea. It often blocks one client's access to the 136 printer when another client's job is printing. It might freeze the first client's application while it is 137 waiting to get rid of the job. Also, there are frequent complaints about various jobs being printed with their 138 pages mixed with each other. A better concept is the use of a print server: it routes all jobs through one 139 central system, which responds immediately, takes jobs from multiple concurrent clients, and transfers them to 140 the printer(s) in the correct order. 141 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id394045"></a>Raw Print Serving: Vendor Drivers on Windows Clients</h3></div></div></div><p> 142 <a class="indexterm" name="id394053"></a> 143 <a class="indexterm" name="id394060"></a> 144 Most traditionally configured UNIX print servers acting on behalf of 145 Samba's Windows clients represented a really simple setup. Their only 146 task was to manage the “<span class="quote">raw</span>” spooling of all jobs handed to them by 147 Samba. This approach meant that the Windows clients were expected to 148 prepare the print job file that is ready to be sent to the printing 149 device. In this case, a native (vendor-supplied) Windows printer driver needs to 150 be installed on each and every client for the target device. 151 </p><p> 152<a class="indexterm" name="id394077"></a> 153<a class="indexterm" name="id394084"></a> 154 It is possible to configure CUPS, Samba, and your Windows clients in the 155 same traditional and simple way. When CUPS printers are configured 156 for raw print-through mode operation, it is the responsibility of the 157 Samba client to fully render the print job (file). The file must be 158 sent in a format that is suitable for direct delivery to the 159 printer. Clients need to run the vendor-provided drivers to do 160 this. In this case, CUPS will not do any print file format conversion 161 work. 162 </p><p> 163 The easiest printing configuration possible is raw print-through. 164 This is achieved by installation of the printer as if it were physically 165 attached to the Windows client. You then redirect output to a raw network 166 print queue. This procedure may be followed to achieve this: 167 </p><div class="procedure"><a name="id394102"></a><p class="title"><b>Procedure�22.1.�Configuration Steps for Raw CUPS Printing Support</b></p><ol type="1"><li><p> 168<a class="indexterm" name="id394113"></a> 169 Edit <code class="filename">/etc/cups/mime.types</code> to uncomment the line 170 near the end of the file that has: 171</p><pre class="screen"> 172#application/octet-... 173</pre><p> 174 </p></li><li><p> 175<a class="indexterm" name="id394139"></a> 176 Do the same for the file <code class="filename">/etc/cups/mime.convs</code>. 177 </p></li><li><p> 178 Add a raw printer using the Web interface. Point your browser at 179 <code class="constant">http://localhost:631</code>. Enter Administration, and add 180 the printer following the prompts. Do not install any drivers for it. 181 Choose Raw. Choose queue name <code class="constant">Raw Queue</code>. 182 </p></li><li><p> 183 In the <code class="filename">smb.conf</code> file <code class="constant">[printers]</code> section add 184 <a class="indexterm" name="id394185"></a>use client driver = Yes, 185 and in the <code class="constant">[global]</code> section add 186 <a class="indexterm" name="id394196"></a>printing = CUPS, plus 187 <a class="indexterm" name="id394203"></a>printcap = CUPS. 188 </p></li><li><p> 189 Install the printer as if it is a local printer, that is, Printing to <code class="constant">LPT1:</code>. 190 </p></li><li><p> 191 Edit the configuration under the <span class="guimenu">Detail</span> tab and create a 192 <code class="constant">local port</code> that points to the raw printer queue that 193 you have configured above. Example: <code class="constant">\\server\raw_q</code>. 194 Here, the name <code class="constant">raw_q</code> is the name you gave the print 195 queue in the CUPS environment. 196 </p></li></ol></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id394249"></a>Installation of Windows Client Drivers</h3></div></div></div><p> 197 The printer drivers on the Windows clients may be installed 198 in two functionally different ways: 199 </p><div class="itemizedlist"><ul type="disc"><li><p>Manually install the drivers locally on each client, 200 one by one; this yields the old LanMan style 201 printing and uses a <code class="filename">\\sambaserver\printershare</code> 202 type of connection.</p></li><li><p> 203 <a class="indexterm" name="id394276"></a> 204 Deposit and prepare the drivers (for later download) on 205 the print server (Samba); this enables the clients to use 206 “<span class="quote">Point'n'Print</span>” to get drivers semi-automatically installed the 207 first time they access the printer; with this method NT/200x/XP 208 clients use the <span class="emphasis"><em>SPOOLSS/MS-RPC</em></span> 209 type printing calls.</p></li></ul></div><p> 210 The second method is recommended for use over the first. 211 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="cups-raw"></a>Explicitly Enable “<span class="quote">raw</span>” Printing for <span class="emphasis"><em>application/octet-stream</em></span></h3></div></div></div><p> 212 <a class="indexterm" name="id394316"></a> 213 <a class="indexterm" name="id394323"></a> 214 <a class="indexterm" name="id394330"></a> 215 If you use the first option (drivers are installed on the client 216 side), there is one setting to take care of: CUPS needs to be told 217 that it should allow “<span class="quote">raw</span>” printing of deliberate (binary) file 218 formats. The CUPS files that need to be correctly set for raw mode 219 printers to work are: 220 </p><div class="itemizedlist"><ul type="disc"><li><p><code class="filename">/etc/cups/mime.types</code></p></li><li><p><code class="filename">/etc/cups/mime.convs</code></p></li></ul></div><p> 221 Both contain entries (at the end of the respective files) that must be uncommented to allow RAW mode 222 operation. In <code class="filename">/etc/cups/mime.types</code>, make sure this line is present: 223</p><pre class="programlisting"> 224application/octet-stream 225</pre><p> 226 <a class="indexterm" name="id394380"></a> 227 <a class="indexterm" name="id394387"></a> 228 In <code class="filename">/etc/cups/mime.convs</code>, have this line: 229 <a class="indexterm" name="id394400"></a> 230</p><pre class="programlisting"> 231application/octet-stream application/vnd.cups-raw 0 - 232</pre><p> 233 If these two files are not set up correctly for raw Windows client 234 printing, you may encounter the dreaded <code class="computeroutput">Unable to 235 convert file 0</code> in your CUPS <code class="filename">error_log</code> file. 236 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 237 Editing the <code class="filename">mime.convs</code> and the <code class="filename">mime.types</code> file does 238 not <span class="emphasis"><em>enforce</em></span> “<span class="quote">raw</span>” printing, it only <span class="emphasis"><em>allows</em></span> it. 239 </p></div><p><b>Background.�</b> 240 <a class="indexterm" name="id394461"></a> 241<a class="indexterm" name="id394468"></a> 242 That CUPS is a more security-aware printing system than traditional ones does not by default allow a user to 243 send deliberate (possibly binary) data to printing devices. This could be easily abused to launch a 244 “<span class="quote">Denial of Service</span>” attack on your printer(s), causing at least the loss of a lot of paper and 245 ink. “<span class="quote">Unknown</span>” data are tagged by CUPS as <em class="parameter"><code>MIME type: application/octet-stream</code></em> 246 and not allowed to go to the printer. By default, you can only send other (known) MIME types “<span class="quote">raw.</span>” 247 Sending data “<span class="quote">raw</span>” means that CUPS does not try to convert them and passes them to the printer 248 untouched. 249 </p><p> 250 This is all you need to know to get the CUPS/Samba combo printing 251 “<span class="quote">raw</span>” files prepared by Windows clients, which have vendor drivers 252 locally installed. If you are not interested in background information about 253 more advanced CUPS/Samba printing, simply skip the remaining sections 254 of this chapter. 255 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id394512"></a>Driver Upload Methods</h3></div></div></div><p> 256 This section describes three familiar methods, plus one new one, by which 257 printer drivers may be uploaded. 258 </p><p> 259 <a class="indexterm" name="id394524"></a> 260 If you want to use the MS-RPC-type printing, you must upload the 261 drivers onto the Samba server first (<em class="parameter"><code>[print$]</code></em> 262 share). For a discussion on how to deposit printer drivers on the 263 Samba host (so the Windows clients can download and use them via 264 “<span class="quote">Point'n'Print</span>”), please refer to the <a href="classicalprinting.html" title="Chapter�21.�Classical Printing Support">Classical Printing 265 chapter</a> of this book. There you will find a description or reference to 266 three methods of preparing the client drivers on the Samba server: 267 </p><div class="itemizedlist"><ul type="disc"><li><p> 268 <a class="indexterm" name="id394557"></a> 269 The GUI, “<span class="quote">Add Printer Wizard</span>” <span class="emphasis"><em>upload-from-a-Windows-client</em></span> method. 270 </p></li><li><p> 271 The command line, “<span class="quote">smbclient/rpcclient</span>” upload-from-a-UNIX-workstation method. 272 </p></li><li><p> 273 <a class="indexterm" name="id394584"></a> 274 The Imprints tool set method. 275 </p></li></ul></div><p> 276<a class="indexterm" name="id394595"></a> 277 These three methods apply to CUPS all the same. The <code class="literal">cupsaddsmb</code> utility is a new and more 278 convenient way to load the Windows drivers into Samba and is provided if you use CUPS. 279 </p><p> 280 <code class="literal">cupsaddsmb</code> is discussed in much detail later in this chapter. But we first 281 explore the CUPS filtering system and compare the Windows and UNIX printing architectures. 282 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id394623"></a>Advanced Intelligent Printing with PostScript Driver Download</h2></div></div></div><p> 283 <a class="indexterm" name="id394631"></a> 284 We now know how to set up a “<span class="quote">dump</span>” print server, that is, a server that spools 285 print jobs “<span class="quote">raw</span>”, leaving the print data untouched. 286 </p><p> 287 You might need to set up CUPS in a smarter way. The reasons could be manifold: 288 </p><a class="indexterm" name="id394654"></a><a class="indexterm" name="id394660"></a><a class="indexterm" name="id394667"></a><div class="itemizedlist"><ul type="disc"><li><p>Maybe your boss wants to get monthly statistics: Which 289 printer did how many pages? What was the average data size of a job? 290 What was the average print run per day? What are the typical hourly 291 peaks in printing? Which department prints how much?</p></li><li><p>Maybe you are asked to set up a print quota system: 292 Users should not be able to print more jobs once they have surpassed 293 a given limit per period.</p></li><li><p>Maybe your previous network printing setup is a mess 294 and must be re-organized from a clean beginning.</p></li><li><p>Maybe you are experiencing too many “<span class="quote">blue screens</span>” 295 originating from poorly debugged printer drivers running in NT “<span class="quote">kernel mode</span>”?</p></li></ul></div><p> 296 These goals cannot be achieved by a raw print server. To build a 297 server meeting these requirements, you'll first need to learn 298 how CUPS works and how you can enable its features. 299 </p><p> 300 What follows is the comparison of some fundamental concepts for 301 Windows and UNIX printing, then a description of the 302 CUPS filtering system, how it works, and how you can tweak it. 303 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="gdipost"></a>GDI on Windows, PostScript on UNIX</h3></div></div></div><p> 304 <a class="indexterm" name="id394728"></a> 305 <a class="indexterm" name="id394735"></a> 306 Network printing is one of the most complicated and error-prone 307 day-to-day tasks any user or administrator may encounter. This is 308 true for all OS platforms, and there are reasons it is so. 309 </p><p> 310 <a class="indexterm" name="id394746"></a> 311 <a class="indexterm" name="id394753"></a> 312<a class="indexterm" name="id394759"></a> 313<a class="indexterm" name="id394766"></a> 314<a class="indexterm" name="id394773"></a> 315 You can't expect to throw just any file format at a printer and have it get printed. A file format conversion 316 must take place. The problem is that there is no common standard for print file formats across all 317 manufacturers and printer types. While PostScript (trademark held by Adobe) and, to an extent, PCL (trademark 318 held by Hewlett-Packard) have developed into semi-official “<span class="quote">standards</span>” by being the most widely 319 used page description languages (PDLs), there are still many manufacturers who “<span class="quote">roll their own</span>” 320 (their reasons may be unacceptable license fees for using printer-embedded PostScript interpreters, and so on). 321 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id394797"></a>Windows Drivers, GDI, and EMF</h3></div></div></div><p> 322 <a class="indexterm" name="id394804"></a> 323 <a class="indexterm" name="id394811"></a> 324 <a class="indexterm" name="id394818"></a> 325<a class="indexterm" name="id394824"></a> 326 In Windows OS, the format conversion job is done by the printer drivers. On MS Windows OS platforms all 327 application programmers have at their disposal a built-in API, the graphical device interface (GDI), as part 328 and parcel of the OS itself to base themselves on. This GDI core is used as one common unified ground for all 329 Windows programs to draw pictures, fonts, and documents <span class="emphasis"><em>on screen</em></span> as well as <span class="emphasis"><em>on 330 paper</em></span> (print). Therefore, printer driver developers can standardize on a well-defined GDI output 331 for their own driver input. Achieving WYSIWYG (What You See Is What You Get) is relatively easy, because the 332 on-screen graphic primitives, as well as the on-paper drawn objects, come from one common source. This source, 333 the GDI, often produces a file format called Enhanced MetaFile (EMF). The EMF is processed by the printer 334 driver and converted to the printer-specific file format. 335 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 336 <a class="indexterm" name="id394852"></a> 337<a class="indexterm" name="id394859"></a> 338<a class="indexterm" name="id394866"></a> 339 To the GDI foundation in MS Windows, Apple has chosen to put paper and screen output on a common foundation 340 for its (BSD-UNIX-based, did you know?) Mac OS X and Darwin operating <a class="indexterm" name="id394874"></a> <a class="indexterm" name="id394881"></a> 341 <a class="indexterm" name="id394888"></a> <a class="indexterm" name="id394894"></a> systems. 342 Apple's <span class="emphasis"><em>core graphic engine</em></span> uses a <span class="emphasis"><em>PDF</em></span> derivative for all display work. 343 </p></div><p> 344 The example in <a href="CUPS-printing.html#1small" title="Figure�22.1.�Windows Printing to a Local Printer.">Windows Printing to a Local Printer</a> illustrates local Windows 345 printing. 346 </p><div class="figure"><a name="1small"></a><p class="title"><b>Figure�22.1.�Windows Printing to a Local Printer.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/1small.png" alt="Windows Printing to a Local Printer."></div></div></div><br class="figure-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id394963"></a>UNIX Printfile Conversion and GUI Basics</h3></div></div></div><p> 347 <a class="indexterm" name="id394971"></a> 348 <a class="indexterm" name="id394978"></a> 349 <a class="indexterm" name="id394984"></a> 350 <a class="indexterm" name="id394991"></a> 351 In UNIX and Linux, there is no comparable layer built into the OS kernel(s) or the X (screen display) server. 352 Every application is responsible for itself to create its print output. Fortunately, most use PostScript and 353 that at least gives some common ground. Unfortunately, there are many different levels of quality for this 354 PostScript. And worse, there is a huge difference (and no common root) in the way the same document is 355 displayed on screen and how it is presented on paper. WYSIWYG is more difficult to achieve. This goes back to 356 the time, decades ago, when the predecessors of X.org, designing the UNIX foundations and protocols for 357 graphical user interfaces, refused to take responsibility for “<span class="quote">paper output</span>”, as some had 358 demanded at the time, and restricted itself to “<span class="quote">on-screen only.</span>” (For some years now, the 359 “<span class="quote">Xprint</span>” project has been under development, attempting to build printing support into the X 360 framework, including a PostScript and a PCL driver, but it is not yet ready for prime time.) You can see this 361 unfavorable inheritance up to the present day by looking into the various “<span class="quote">font</span>” directories on 362 your system; there are separate ones for fonts used for X display and fonts to be used on paper. 363 </p><p><b>Background.�</b> 364 <a class="indexterm" name="id395031"></a> 365<a class="indexterm" name="id395038"></a> 366<a class="indexterm" name="id395045"></a> 367<a class="indexterm" name="id395051"></a> 368<a class="indexterm" name="id395058"></a> 369<a class="indexterm" name="id395065"></a> 370<a class="indexterm" name="id395072"></a> 371<a class="indexterm" name="id395079"></a> 372<a class="indexterm" name="id395085"></a> 373<a class="indexterm" name="id395092"></a> 374 The PostScript programming language is an “<span class="quote">invention</span>” by Adobe, but its specifications have been 375 published extensively. Its strength lies in its powerful abilities to describe graphical objects (fonts, 376 shapes, patterns, lines, curves, and dots), their attributes (color, linewidth), and the way to manipulate 377 (scale, distort, rotate, shift) them. Because of its open specification, anybody with the skill can start 378 writing his or her own implementation of a PostScript interpreter and use it to display PostScript files on 379 screen or on paper. Most graphical output devices are based on the concept of “<span class="quote">raster images</span>” or 380 “<span class="quote">pixels</span>” (one notable exception is pen plotters). Of course, you can look at a PostScript file in 381 its textual form and you will be reading its PostScript code, the language instructions that need to be 382 interpreted by a rasterizer. Rasterizers produce pixel images, which may be displayed on screen by a viewer 383 program or on paper by a printer. 384 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="post-and-ghost"></a>PostScript and Ghostscript</h3></div></div></div><p> 385 <a class="indexterm" name="id395133"></a> 386 <a class="indexterm" name="id395139"></a> 387 <a class="indexterm" name="id395148"></a> 388<a class="indexterm" name="id395158"></a> 389<a class="indexterm" name="id395164"></a> 390 So UNIX is lacking a common ground for printing on paper and displaying on screen. Despite this unfavorable 391 legacy for UNIX, basic printing is fairly easy if you have PostScript printers at your disposal. The reason is 392 that these devices have a built-in PostScript language “<span class="quote">interpreter,</span>” also called a raster image 393 processor (RIP), (which makes them more expensive than other types of printers; throw PostScript toward them, 394 and they will spit out your printed pages. The RIP does all the hard work of converting the PostScript drawing 395 commands into a bitmap picture as you see it on paper, in a resolution as done by your printer. This is no 396 different than PostScript printing a file from a Windows origin. 397 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 398 <a class="indexterm" name="id395187"></a> 399<a class="indexterm" name="id395194"></a> 400<a class="indexterm" name="id395200"></a> 401 Traditional UNIX programs and printing systems while using PostScript are largely not 402 PPD-aware. PPDs are “<span class="quote">PostScript Printer Description</span>” files. They enable you to specify and 403 control all options a printer supports: duplexing, stapling, and punching. Therefore, UNIX users for a long 404 time couldn't choose many of the supported device and job options, unlike Windows or Apple users. But now 405 there is CUPS. as illustrated in <a href="CUPS-printing.html#2small" title="Figure�22.2.�Printing to a PostScript Printer.">Printing to a PostScript Printer</a>. 406 </p></div><div class="figure"><a name="2small"></a><p class="title"><b>Figure�22.2.�Printing to a PostScript Printer.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/2small.png" alt="Printing to a PostScript Printer."></div></div></div><br class="figure-break"><p> 407 <a class="indexterm" name="id395274"></a> 408 However, there are other types of printers out there. These do not know how to print PostScript. They use 409 their own PDL, often proprietary. To print to them is much more demanding. Since your UNIX applications mostly 410 produce PostScript, and since these devices do not understand PostScript, you need to convert the print files 411 to a format suitable for your printer on the host before you can send it away. 412 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id395287"></a>Ghostscript: The Software RIP for Non-PostScript Printers</h3></div></div></div><p> 413 <a class="indexterm" name="id395295"></a> 414 Here is where Ghostscript kicks in. Ghostscript is the traditional (and quite powerful) PostScript interpreter 415 used on UNIX platforms. It is a RIP in software, capable of doing a <span class="emphasis"><em>lot</em></span> of file format 416 conversions for a very broad spectrum of hardware devices as well as software file formats. Ghostscript 417 technology and drivers are what enable PostScript printing to non-PostScript hardware. This is shown in 418 <a href="CUPS-printing.html#3small" title="Figure�22.3.�Ghostscript as a RIP for Non-PostScript Printers.">Ghostscript as a RIP for Non-PostScript Printers</a>. 419 </p><div class="figure"><a name="3small"></a><p class="title"><b>Figure�22.3.�Ghostscript as a RIP for Non-PostScript Printers.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/3small.png" alt="Ghostscript as a RIP for Non-PostScript Printers."></div></div></div><br class="figure-break"><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p> 420<a class="indexterm" name="id395360"></a> 421<a class="indexterm" name="id395367"></a> 422<a class="indexterm" name="id395374"></a> 423 Use the “<span class="quote">gs -h</span>” command to check for all built-in “<span class="quote">devices</span>” on your Ghostscript 424 version. If you specify a parameter of <em class="parameter"><code>-sDEVICE=png256</code></em> on your Ghostscript command 425 line, you are asking Ghostscript to convert the input into a PNG file. Naming a “<span class="quote">device</span>” on the 426 command line is the most important single parameter to tell Ghostscript exactly how it should render the 427 input. New Ghostscript versions are released at fairly regular intervals, now by artofcode LLC. They are 428 initially put under the “<span class="quote">AFPL</span>” license, but re-released under the GNU GPL as soon as the next 429 AFPL version appears. GNU Ghostscript is probably the version installed on most Samba systems. But it has some 430 deficiencies. <a class="indexterm" name="id395406"></a> Therefore, ESP Ghostscript was developed as an enhancement over GNU Ghostscript, 431 with lots of bug-fixes, additional devices, and improvements. It is jointly maintained by developers from 432 CUPS, Gimp-Print, MandrakeSoft, SuSE, Red Hat, and Debian. It includes the “<span class="quote">cups</span>” device 433 (essential to print to non-PS printers from CUPS). 434 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id395426"></a>PostScript Printer Description (PPD) Specification</h3></div></div></div><p> 435 <a class="indexterm" name="id395434"></a> 436<a class="indexterm" name="id395441"></a> 437<a class="indexterm" name="id395447"></a> 438 While PostScript in essence is a PDL to represent the page layout in a device-independent way, real-world 439 print jobs are always ending up being output on hardware with device-specific features. To take care of all 440 the differences in hardware and to allow for innovations, Adobe has specified a syntax and file format for 441 PostScript Printer Description (PPD) files. Every PostScript printer ships with one of these files. 442 </p><p> 443 PPDs contain all the information about general and special features of the 444 given printer model: Which different resolutions can it handle? Does 445 it have a duplexing unit? How many paper trays are there? What media 446 types and sizes does it take? For each item, it also names the special 447 command string to be sent to the printer (mostly inside the PostScript 448 file) in order to enable it. 449 </p><p> 450 Information from these PPDs is meant to be taken into account by the 451 printer drivers. Therefore, installed as part of the Windows 452 PostScript driver for a given printer is the printer's PPD. Where it 453 makes sense, the PPD features are presented in the drivers' UI dialogs 454 to display to the user a choice of print options. In the end, the 455 user selections are somehow written (in the form of special 456 PostScript, PJL, JCL, or vendor-dependent commands) into the PostScript 457 file created by the driver. 458 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p> 459 <a class="indexterm" name="id395476"></a> 460<a class="indexterm" name="id395483"></a> 461 A PostScript file that was created to contain device-specific commands 462 for achieving a certain print job output (e.g., duplexed, stapled, and 463 punched) on a specific target machine may not print as expected, or 464 may not be printable at all on other models; it also may not be fit 465 for further processing by software (e.g., by a PDF distilling program). 466 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id395495"></a>Using Windows-Formatted Vendor PPDs</h3></div></div></div><p> 467<a class="indexterm" name="id395503"></a> 468<a class="indexterm" name="id395510"></a> 469<a class="indexterm" name="id395516"></a> 470 CUPS can handle all spec-compliant PPDs as supplied by the manufacturers for their PostScript models. Even if 471 a vendor does not mention our favorite OS in his or her manuals and brochures, you can safely trust this: 472 <span class="emphasis"><em>If you get the Windows NT version of the PPD, you can use it unchanged in CUPS</em></span> and thus 473 access the full power of your printer just like a Windows NT user could! 474 </p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p> 475 To check the spec compliance of any PPD online, go to <a href="http://www.cups.org/testppd.php" target="_top">http://www.cups.org/testppd.php</a> and upload your PPD. You will 476 see the results displayed immediately. CUPS in all versions after 1.1.19 has a much stricter internal PPD 477 parsing and checking code enabled; in case of printing trouble, this online resource should be one of your 478 first pit stops. 479 </p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p> 480 <a class="indexterm" name="id395550"></a> 481 <a class="indexterm" name="id395556"></a> 482 For real PostScript printers, <span class="emphasis"><em>do not</em></span> use the <span class="emphasis"><em>Foomatic</em></span> or 483 <span class="emphasis"><em>cupsomatic</em></span> PPDs from Linuxprinting.org. With these devices, the original vendor-provided 484 PPDs are always the first choice. 485 </p></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p> 486<a class="indexterm" name="id395580"></a> 487 If you are looking for an original vendor-provided PPD of a specific device, and you know that an NT4 box (or 488 any other Windows box) on your LAN has the PostScript driver installed, just use <code class="literal">smbclient 489 //NT4-box/print\$ -U username</code> to access the Windows directory where all printer driver files are 490 stored. First look in the <code class="filename">W32X86/2</code> subdirectory for the PPD you are seeking. 491 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id395604"></a>CUPS Also Uses PPDs for Non-PostScript Printers</h3></div></div></div><p> 492<a class="indexterm" name="id395612"></a> 493<a class="indexterm" name="id395618"></a> 494<a class="indexterm" name="id395625"></a> 495 CUPS also uses specially crafted PPDs to handle non-PostScript printers. These PPDs are usually not available 496 from the vendors (and no, you can't just take the PPD of a PostScript printer with the same model name and 497 hope it works for the non-PostScript version too). To understand how these PPDs work for non-PS printers, we 498 first need to dive deeply into the CUPS filtering and file format conversion architecture. Stay tuned. 499 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id395639"></a>The CUPS Filtering Architecture</h2></div></div></div><p> 500<a class="indexterm" name="id395647"></a> 501<a class="indexterm" name="id395653"></a> 502<a class="indexterm" name="id395660"></a> 503<a class="indexterm" name="id395667"></a> 504<a class="indexterm" name="id395674"></a> 505The core of the CUPS filtering system is based on Ghostscript. In addition to Ghostscript, CUPS uses some 506other filters of its own. You (or your OS vendor) may have plugged in even more filters. CUPS handles all data 507file formats under the label of various MIME types. Every incoming print file is subjected to an initial 508autotyping. The autotyping determines its given MIME type. A given MIME type implies zero or more possible 509filtering chains relevant to the selected target printer. This section discusses how MIME types recognition 510and conversion rules interact. They are used by CUPS to automatically set up a working filtering chain for any 511given input data format. 512</p><p> 513If CUPS rasterizes a PostScript file natively to a bitmap, this is done in two stages: 514</p><div class="itemizedlist"><ul type="disc"><li><p> 515<a class="indexterm" name="id395702"></a> 516<a class="indexterm" name="id395709"></a> 517 The first stage uses a Ghostscript device named “<span class="quote">cups</span>” 518 (this is since version 1.1.15) and produces a generic raster format 519 called “<span class="quote">CUPS raster</span>”. 520 </p></li><li><p> 521<a class="indexterm" name="id395729"></a> 522 The second stage uses a “<span class="quote">raster driver</span>” that converts 523 the generic CUPS raster to a device-specific raster. 524 </p></li></ul></div><p> 525<a class="indexterm" name="id395744"></a> 526<a class="indexterm" name="id395751"></a> 527<a class="indexterm" name="id395758"></a> 528Make sure your Ghostscript version has the “<span class="quote">cups</span>” device compiled in (check with <code class="literal">gs -h | 529grep cups</code>). Otherwise you may encounter the dreaded <code class="computeroutput">Unable to convert file 5300</code> in your CUPS error_log file. To have “<span class="quote">cups</span>” as a device in your Ghostscript, 531you either need to patch GNU Ghostscript and recompile or use 532<a class="indexterm" name="id395786"></a><a href="http://www.cups.org/ghostscript.php" target="_top">ESP Ghostscript</a>. The superior alternative is ESP 533Ghostscript. It supports not just CUPS, but 300 other devices (while GNU Ghostscript supports only about 180). 534Because of this broad output device support, ESP Ghostscript is the first choice for non-CUPS spoolers, too. 535It is now recommended by Linuxprinting.org for all spoolers. 536</p><p> 537<a class="indexterm" name="id395806"></a> 538<a class="indexterm" name="id395812"></a> 539<a class="indexterm" name="id395819"></a> 540<a class="indexterm" name="id395826"></a> 541CUPS printers may be set up to use external rendering paths. One of the most common is provided by the 542Foomatic/cupsomatic concept from <a href="http://www.linuxprinting.org/" target="_top">Linuxprinting.org</a>. This 543uses the classical Ghostscript approach, doing everything in one step. It does not use the 544“<span class="quote">cups</span>” device, but one of the many others. However, even for Foomatic/cupsomatic usage, best 545results and <a class="indexterm" name="id395845"></a> broadest printer 546model support is provided by ESP Ghostscript (more about Foomatic/cupsomatic, particularly the new version 547called now <span class="emphasis"><em>foomatic-rip</em></span>, follows). 548</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id395860"></a>MIME Types and CUPS Filters</h3></div></div></div><p> 549 <a class="indexterm" name="id395868"></a> 550 <a class="indexterm" name="id395878"></a> 551<a class="indexterm" name="id395884"></a> 552<a class="indexterm" name="id395891"></a> 553<a class="indexterm" name="id395898"></a> 554 CUPS reads the file <code class="filename">/etc/cups/mime.types</code> (and all other files carrying a 555 <code class="filename">*.types</code> suffix in the same directory) upon startup. These files contain the MIME type 556 recognition rules that are applied when CUPS runs its autotyping routines. The rule syntax is explained in the 557 man page for <code class="filename">mime.types</code> and in the comments section of the 558 <code class="filename">mime.types</code> file itself. A simple rule reads like this: 559 <a class="indexterm" name="id395931"></a> 560</p><pre class="programlisting"> 561application/pdf pdf string(0,%PDF) 562</pre><p> 563<a class="indexterm" name="id395944"></a> 564<a class="indexterm" name="id395951"></a> 565 This means if a filename has a <code class="filename">.pdf</code> suffix or if the magic string 566 <span class="emphasis"><em>%PDF</em></span> is right at the beginning of the file itself (offset 0 from the start), then it is a 567 PDF file (<em class="parameter"><code>application/pdf</code></em>). Another rule is this: 568</p><pre class="programlisting"> 569application/postscript ai eps ps string(0,%!) string(0,<04>%!) 570</pre><p> 571<a class="indexterm" name="id395981"></a> 572<a class="indexterm" name="id395988"></a> 573<a class="indexterm" name="id395995"></a> 574<a class="indexterm" name="id396002"></a> 575<a class="indexterm" name="id396008"></a> 576<a class="indexterm" name="id396015"></a> 577 If the filename has one of the suffixes <code class="filename">.ai</code>, <code class="filename">.eps</code>, 578 <code class="filename">.ps</code>, or if the file itself starts with one of the strings <span class="emphasis"><em>%!</em></span> or 579 <span class="emphasis"><em><04>%!</em></span>, it is a generic PostScript file 580 (<em class="parameter"><code>application/postscript</code></em>). 581 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p> 582<a class="indexterm" name="id396057"></a> 583 Don't confuse the other mime.types files your system might be using 584 with the one in the <code class="filename">/etc/cups/</code> directory. 585 </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 586<a class="indexterm" name="id396075"></a> 587<a class="indexterm" name="id396082"></a> 588<a class="indexterm" name="id396089"></a> 589<a class="indexterm" name="id396095"></a> 590<a class="indexterm" name="id396102"></a> 591 There is an important difference between two similar MIME types in CUPS: one is 592 <em class="parameter"><code>application/postscript</code></em>, the other is 593 <em class="parameter"><code>application/vnd.cups-postscript</code></em>. While <em class="parameter"><code>application/postscript</code></em> is 594 meant to be device-independent, job options for the file are still outside the PS file content, embedded in 595 command-line or environment variables by CUPS, <em class="parameter"><code>application/vnd.cups-postscript</code></em> may have 596 the job options inserted into the PostScript data itself (where applicable). The transformation of the generic 597 PostScript (<em class="parameter"><code>application/postscript</code></em>) to the device-specific version 598 (<em class="parameter"><code>application/vnd.cups-postscript</code></em>) is the responsibility of the CUPS 599 <em class="parameter"><code>pstops</code></em> filter. pstops uses information contained in the PPD to do the transformation. 600 </p></div><p> 601<a class="indexterm" name="id396158"></a> 602<a class="indexterm" name="id396165"></a> 603<a class="indexterm" name="id396172"></a> 604<a class="indexterm" name="id396178"></a> 605<a class="indexterm" name="id396185"></a> 606<a class="indexterm" name="id396192"></a> 607<a class="indexterm" name="id396198"></a> 608<a class="indexterm" name="id396205"></a> 609<a class="indexterm" name="id396211"></a> 610<a class="indexterm" name="id396218"></a> 611<a class="indexterm" name="id396225"></a> 612<a class="indexterm" name="id396232"></a> 613<a class="indexterm" name="id396239"></a> 614<a class="indexterm" name="id396245"></a> 615<a class="indexterm" name="id396252"></a> 616<a class="indexterm" name="id396259"></a> 617 CUPS can handle ASCII text, HP-GL, PDF, PostScript, DVI, and 618 many image formats (GIF, PNG, TIFF, JPEG, Photo-CD, SUN-Raster, 619 PNM, PBM, SGI-RGB, and more) and their associated MIME types 620 with its filters. 621 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id396270"></a>MIME Type Conversion Rules</h3></div></div></div><p> 622 <a class="indexterm" name="id396278"></a> 623 <a class="indexterm" name="id396284"></a> 624<a class="indexterm" name="id396291"></a> 625<a class="indexterm" name="id396298"></a> 626<a class="indexterm" name="id396305"></a> 627 CUPS reads the file <code class="filename">/etc/cups/mime.convs</code> 628 (and all other files named with a <code class="filename">*.convs</code> 629 suffix in the same directory) upon startup. These files contain 630 lines naming an input MIME type, an output MIME type, a format 631 conversion filter that can produce the output from the input type, 632 and virtual costs associated with this conversion. One example line 633 reads like this: 634</p><pre class="programlisting"> 635application/pdf application/postscript 33 pdftops 636</pre><p> 637<a class="indexterm" name="id396332"></a> 638 This means that the <em class="parameter"><code>pdftops</code></em> filter will take 639 <em class="parameter"><code>application/pdf</code></em> as input and produce 640 <em class="parameter"><code>application/postscript</code></em> as output; the virtual 641 cost of this operation is 33 CUPS-$. The next filter is more 642 expensive, costing 66 CUPS-$: 643 <a class="indexterm" name="id396358"></a> 644</p><pre class="programlisting"> 645application/vnd.hp-HPGL application/postscript 66 hpgltops 646</pre><p> 647<a class="indexterm" name="id396371"></a> 648 This is the <em class="parameter"><code>hpgltops</code></em>, which processes HP-GL 649 plotter files to PostScript. 650 <a class="indexterm" name="id396384"></a> 651</p><pre class="programlisting"> 652application/octet-stream 653</pre><p> 654 Here are two more examples: 655 <a class="indexterm" name="id396398"></a> 656<a class="indexterm" name="id396404"></a> 657<a class="indexterm" name="id396411"></a> 658<a class="indexterm" name="id396418"></a> 659</p><pre class="programlisting"> 660application/x-shell application/postscript 33 texttops 661text/plain application/postscript 33 texttops 662</pre><p> 663<a class="indexterm" name="id396431"></a> 664 The last two examples name the <em class="parameter"><code>texttops</code></em> filter to work on 665 <em class="parameter"><code>text/plain</code></em> as well as on <em class="parameter"><code>application/x-shell</code></em>. (Hint: This 666 differentiation is needed for the syntax highlighting feature of <em class="parameter"><code>texttops</code></em>). 667 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id396465"></a>Filtering Overview</h3></div></div></div><p> 668 <a class="indexterm" name="id396473"></a> 669 There are many more combinations named in <code class="filename">mime.convs</code>. However, you are not limited to use 670 the ones predefined there. You can plug in any filter you like to the CUPS framework. It must meet, or must be 671 made to meet, some minimal requirements. If you find (or write) a cool conversion filter of some kind, make 672 sure it complies with what CUPS needs and put in the right lines in <code class="filename">mime.types</code> and 673 <code class="filename">mime.convs</code>; then it will work seamlessly inside CUPS. 674 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id396505"></a>Filter Requirements</h4></div></div></div><p> 675 The “<span class="quote">CUPS requirements</span>” for filters are simple. Take filenames or <code class="filename">stdin</code> as 676 input and write to <code class="filename">stdout</code>. They should take these arguments: 677 </p><div class="variablelist"><dl><dt><span class="term">printer</span></dt><dd><p> 678 The name of the printer queue (normally this is the name of the filter being run). 679 </p></dd><dt><span class="term">job</span></dt><dd><p> 680 The numeric job ID for the job being printed. 681 </p></dd><dt><span class="term">user</span></dt><dd><p> 682 The string from the originating-user-name attribute. 683 </p></dd><dt><span class="term">title</span></dt><dd><p> 684 The string from the job-name attribute. 685 </p></dd><dt><span class="term">copies</span></dt><dd><p> 686 The numeric value from the number-copies attribute. 687 </p></dd><dt><span class="term">options</span></dt><dd><p> 688 The job options. 689 </p></dd><dt><span class="term">filename</span></dt><dd><p> 690 (optionally) The print request file (if missing, filters expected data 691 fed through <code class="filename">stdin</code>). In most cases, it is easy to 692 write a simple wrapper script around existing filters to make them work with CUPS. 693 </p></dd></dl></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id396616"></a>Prefilters</h3></div></div></div><p> 694 <a class="indexterm" name="id396624"></a> 695<a class="indexterm" name="id396631"></a> 696<a class="indexterm" name="id396637"></a> 697 As previously stated, PostScript is the central file format to any UNIX-based 698 printing system. From PostScript, CUPS generates raster data to feed 699 non-PostScript printers. 700 </p><p> 701<a class="indexterm" name="id396649"></a> 702<a class="indexterm" name="id396656"></a> 703<a class="indexterm" name="id396663"></a> 704<a class="indexterm" name="id396669"></a> 705<a class="indexterm" name="id396676"></a> 706<a class="indexterm" name="id396682"></a> 707<a class="indexterm" name="id396689"></a> 708<a class="indexterm" name="id396696"></a> 709<a class="indexterm" name="id396703"></a> 710<a class="indexterm" name="id396710"></a> 711 But what happens if you send one of the supported non-PS formats to print? Then CUPS runs 712 “<span class="quote">prefilters</span>” on these input formats to generate PostScript first. There are prefilters to create 713 PostScript from ASCII text, PDF, DVI, or HP-GL. The outcome of these filters is always of MIME type 714 <em class="parameter"><code>application/postscript</code></em> (meaning that any device-specific print options are not yet 715 embedded into the PostScript by CUPS and that the next filter to be called is pstops). Another prefilter is 716 running on all supported image formats, the <em class="parameter"><code>imagetops</code></em> filter. Its outcome is always of 717 MIME type <em class="parameter"><code>application/vnd.cups-postscript</code></em> (not application/postscript), meaning it has 718 the print options already embedded into the file. This is shown in <a href="CUPS-printing.html#4small" title="Figure�22.4.�Prefiltering in CUPS to Form PostScript.">Prefiltering in 719 CUPS to Form PostScript</a>. 720 </p><div class="figure"><a name="4small"></a><p class="title"><b>Figure�22.4.�Prefiltering in CUPS to Form PostScript.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/4small.png" width="135" alt="Prefiltering in CUPS to Form PostScript."></div></div></div><br class="figure-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id396793"></a>pstops</h3></div></div></div><p> 721<a class="indexterm" name="id396801"></a> 722<a class="indexterm" name="id396808"></a> 723<a class="indexterm" name="id396814"></a> 724<a class="indexterm" name="id396821"></a> 725<a class="indexterm" name="id396828"></a> 726<a class="indexterm" name="id396835"></a> 727<a class="indexterm" name="id396842"></a> 728 <span class="emphasis"><em>pstops</em></span> is a filter that is used to convert <em class="parameter"><code>application/postscript</code></em> to 729 <em class="parameter"><code>application/vnd.cups-postscript</code></em>. As stated earlier, this filter inserts all 730 device-specific print options (commands to the printer to ask for the duplexing of output, or stapling and 731 punching it, and so on) into the PostScript file. An example is illustrated in <a href="CUPS-printing.html#5small" title="Figure�22.5.�Adding Device-Specific Print Options.">Adding Device-Specific Print Options</a>. 732 </p><div class="figure"><a name="5small"></a><p class="title"><b>Figure�22.5.�Adding Device-Specific Print Options.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/5small.png" width="135" alt="Adding Device-Specific Print Options."></div></div></div><br class="figure-break"><p> 733 This is not all. Other tasks performed by it are: 734 </p><div class="itemizedlist"><ul type="disc"><li><p> 735 Selecting the range of pages to be printed (e.g., you can choose to 736 print only pages “<span class="quote">3, 6, 8-11, 16, and 19-21</span>”, or only odd-numbered 737 pages). 738 </p></li><li><p> 739 Putting two or more logical pages on one sheet of paper (the 740 so-called “<span class="quote">number-up</span>” function). 741 </p></li><li><p>Counting the pages of the job to insert the accounting 742 information into the <code class="filename">/var/log/cups/page_log</code>. 743 </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id396952"></a>pstoraster</h3></div></div></div><p> 744<a class="indexterm" name="id396960"></a> 745<a class="indexterm" name="id396967"></a> 746<a class="indexterm" name="id396973"></a> 747 <em class="parameter"><code>pstoraster</code></em> is at the core of the CUPS filtering system. It is responsible for the first 748 stage of the rasterization process. Its input is of MIME type application/vnd.cups-postscript; its output is 749 application/vnd.cups-raster. This output format is not yet meant to be printable. Its aim is to serve as a 750 general-purpose input format for more specialized <span class="emphasis"><em>raster drivers</em></span> that are able to 751 generate device-specific printer data. This is shown in <a href="CUPS-printing.html#cups-raster" title="Figure�22.6.�PostScript to Intermediate Raster Format.">the PostScript to 752 Intermediate Raster Format diagram</a>. 753 </p><div class="figure"><a name="cups-raster"></a><p class="title"><b>Figure�22.6.�PostScript to Intermediate Raster Format.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/6small.png" width="135" alt="PostScript to Intermediate Raster Format."></div></div></div><br class="figure-break"><p> 754<a class="indexterm" name="id397044"></a> 755<a class="indexterm" name="id397051"></a> 756<a class="indexterm" name="id397058"></a> 757<a class="indexterm" name="id397065"></a> 758 CUPS raster is a generic raster format with powerful features. It is able to include per-page information, 759 color profiles, and more, to be used by the downstream raster drivers. Its MIME type is registered with IANA 760 and its specification is, of course, completely open. It is designed to make it quite easy and inexpensive for 761 manufacturers to develop Linux and UNIX raster drivers for their printer models should they choose to do so. 762 CUPS always takes care of the first stage of rasterization so these vendors do not need to care about 763 Ghostscript complications (in fact, there are currently more than one vendor financing the development of CUPS 764 raster drivers). This is illustrated in <a href="CUPS-printing.html#cups-raster2" title="Figure�22.7.�CUPS-Raster Production Using Ghostscript.">the CUPS-Raster Production Using 765 Ghostscript illustration</a>. 766 </p><div class="figure"><a name="cups-raster2"></a><p class="title"><b>Figure�22.7.�CUPS-Raster Production Using Ghostscript.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/7small.png" alt="CUPS-Raster Production Using Ghostscript."></div></div></div><br class="figure-break"><p> 767<a class="indexterm" name="id397129"></a> 768<a class="indexterm" name="id397136"></a> 769<a class="indexterm" name="id397143"></a> 770<a class="indexterm" name="id397149"></a> 771 CUPS versions before version 1.1.15 shipped a binary (or source code) standalone filter, named 772 <em class="parameter"><code>pstoraster</code></em>. <em class="parameter"><code>pstoraster</code></em>, which was derived from GNU Ghostscript 773 5.50 and could be installed instead of and in addition to any GNU or AFPL Ghostscript package without 774 conflicting. 775 </p><p> 776 Since version 1.1.15, this feature has changed. The functions for this filter have been integrated back 777 into Ghostscript (now based on GNU Ghostscript version 7.05). The <em class="parameter"><code>pstoraster</code></em> filter is 778 now a simple shell script calling <code class="literal">gs</code> with the <code class="literal">-sDEVICE=cups</code> parameter. 779 If your Ghostscript fails when this command is executed: <code class="literal">gs -h |grep cups</code>, you might not 780 be able to print, update your Ghostscript. 781 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id397202"></a>imagetops and imagetoraster</h3></div></div></div><p> 782<a class="indexterm" name="id397210"></a> 783<a class="indexterm" name="id397217"></a> 784 In the section about prefilters, we mentioned the prefilter 785 that generates PostScript from image formats. The <em class="parameter"><code>imagetoraster</code></em> 786 filter is used to convert directly from image to raster, without the 787 intermediate PostScript stage. It is used more often than the previously 788 mentioned prefilters. We summarize in a flowchart the image file 789 filtering in <a href="CUPS-printing.html#small8" title="Figure�22.8.�Image Format to CUPS-Raster Format Conversion.">the Image Format to CUPS-Raster Format Conversion illustration</a>. 790 </p><div class="figure"><a name="small8"></a><p class="title"><b>Figure�22.8.�Image Format to CUPS-Raster Format Conversion.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/8small.png" alt="Image Format to CUPS-Raster Format Conversion."></div></div></div><br class="figure-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id397282"></a>rasterto [printers specific]</h3></div></div></div><p> 791<a class="indexterm" name="id397290"></a> 792<a class="indexterm" name="id397297"></a> 793<a class="indexterm" name="id397304"></a> 794<a class="indexterm" name="id397310"></a> 795<a class="indexterm" name="id397317"></a> 796<a class="indexterm" name="id397324"></a> 797<a class="indexterm" name="id397331"></a> 798<a class="indexterm" name="id397338"></a> 799<a class="indexterm" name="id397344"></a> 800<a class="indexterm" name="id397351"></a> 801<a class="indexterm" name="id397358"></a> 802 CUPS ships with quite a variety of raster drivers for processing CUPS raster. On my system, I find in 803 /usr/lib/cups/filter/ the following: <em class="parameter"><code>rastertoalps</code></em>, <em class="parameter"><code>rastertobj</code></em>, 804 <em class="parameter"><code>rastertoepson</code></em>, <em class="parameter"><code>rastertoescp</code></em>, <em class="parameter"><code>rastertopcl</code></em>, 805 <em class="parameter"><code>rastertoturboprint</code></em>, <em class="parameter"><code>rastertoapdk</code></em>, 806 <em class="parameter"><code>rastertodymo</code></em>, <em class="parameter"><code>rastertoescp</code></em>, <em class="parameter"><code>rastertohp</code></em>, 807 and <em class="parameter"><code>rastertoprinter</code></em>. Don't worry if you have fewer drivers than this; some of these are 808 installed by commercial add-ons to CUPS (like <em class="parameter"><code>rastertoturboprint</code></em>), and others (like 809 <em class="parameter"><code>rastertoprinter</code></em>) by third-party driver development projects (such as Gimp-Print) 810 wanting to cooperate as closely as possible with CUPS. See <a href="CUPS-printing.html#small9" title="Figure�22.9.�Raster to Printer-Specific Formats.">the Raster to 811 Printer-Specific Formats illustration</a>. 812 </p><div class="figure"><a name="small9"></a><p class="title"><b>Figure�22.9.�Raster to Printer-Specific Formats.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/9small.png" alt="Raster to Printer-Specific Formats."></div></div></div><br class="figure-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id397494"></a>CUPS Backends</h3></div></div></div><p> 813<a class="indexterm" name="id397502"></a> 814<a class="indexterm" name="id397509"></a> 815 The last part of any CUPS filtering chain is a backend. Backends 816 are special programs that send the print-ready file to the final 817 device. There is a separate backend program for any transfer 818 protocol for sending print jobs over the network, and one for every local 819 interface. Every CUPS print queue needs to have a CUPS “<span class="quote">device-URI</span>” 820 associated with it. The device URI is the way to encode the backend 821 used to send the job to its destination. Network device-URIs use 822 two slashes in their syntax, local device URIs only one, as you can 823 see from the following list. Keep in mind that local interface names 824 may vary greatly from my examples, if your OS is not Linux: 825 </p><div class="variablelist"><dl><dt><span class="term">usb</span></dt><dd><p> 826 This backend sends print files to USB-connected printers. An 827 example for the CUPS device-URI to use is 828 <code class="filename">usb:/dev/usb/lp0</code>. 829 </p></dd><dt><span class="term">serial</span></dt><dd><p> 830 This backend sends print files to serially connected printers. 831 An example for the CUPS device-URI to use is 832 <code class="filename">serial:/dev/ttyS0?baud=11500</code>. 833 </p></dd><dt><span class="term">parallel</span></dt><dd><p> 834 This backend sends print files to printers connected to the 835 parallel port. An example for the CUPS device-URI to use is 836 <code class="filename">parallel:/dev/lp0</code>. 837 </p></dd><dt><span class="term">SCSI</span></dt><dd><p> 838 This backend sends print files to printers attached to the 839 SCSI interface. An example for the CUPS device-URI to use is 840 <code class="filename">scsi:/dev/sr1</code>. 841 </p></dd><dt><span class="term">lpd</span></dt><dd><p> 842 This backend sends print files to LPR/LPD-connected network 843 printers. An example for the CUPS device-URI to use is 844 <code class="filename">lpd://remote_host_name/remote_queue_name</code>. 845 </p></dd><dt><span class="term">AppSocket/HP JetDirect</span></dt><dd><p> 846 This backend sends print files to AppSocket (a.k.a., HP 847 JetDirect) connected network printers. An example for the CUPS 848 device-URI to use is 849 <code class="filename">socket://10.11.12.13:9100</code>. 850 </p></dd><dt><span class="term">ipp</span></dt><dd><p> 851 This backend sends print files to IPP-connected network 852 printers (or to other CUPS servers). Examples for CUPS device-URIs 853 to use are 854 <code class="filename">ipp:://192.193.194.195/ipp</code> 855 (for many HP printers) and 856 <code class="filename">ipp://remote_cups_server/printers/remote_printer_name</code>. 857 </p></dd><dt><span class="term">http</span></dt><dd><p> 858 This backend sends print files to HTTP-connected printers. 859 (The http:// CUPS backend is only a symlink to the ipp:// backend.) 860 Examples for the CUPS device-URIs to use are 861 <code class="filename">http:://192.193.194.195:631/ipp</code> 862 (for many HP printers) and 863 <code class="filename">http://remote_cups_server:631/printers/remote_printer_name</code>. 864 </p></dd><dt><span class="term">smb</span></dt><dd><p> 865 This backend sends print files to printers shared by a Windows 866 host. Examples of CUPS device-URIs that may be used includes: 867 </p><p> 868 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><code class="filename">smb://workgroup/server/printersharename</code></td></tr><tr><td><code class="filename">smb://server/printersharename</code></td></tr><tr><td><code class="filename">smb://username:password@workgroup/server/printersharename</code></td></tr><tr><td><code class="filename">smb://username:password@server/printersharename</code></td></tr></table><p> 869 </p><p> 870 The smb:// backend is a symlink to the Samba utility 871 <em class="parameter"><code>smbspool</code></em> (does not ship with CUPS). If the 872 symlink is not present in your CUPS backend directory, have your 873 root user create it: <code class="literal">ln -s `which smbspool' 874 /usr/lib/cups/backend/smb</code>. 875 </p></dd></dl></div><p> 876 It is easy to write your own backends as shell or Perl scripts if you 877 need any modification or extension to the CUPS print system. One 878 reason could be that you want to create “<span class="quote">special</span>” printers that send 879 the print jobs as email (through a “<span class="quote">mailto:/</span>” backend), convert them to 880 PDF (through a “<span class="quote">pdfgen:/</span>” backend) or dump them to “<span class="quote">/dev/null</span>”. (In 881 fact, I have the systemwide default printer set up to be connected to 882 a devnull:/ backend: there are just too many people sending jobs 883 without specifying a printer, and scripts and programs that do not name 884 a printer. The systemwide default deletes the job and sends a polite 885 email back to the $USER asking him or her to always specify the correct 886 printer name.) 887 </p><p> 888<a class="indexterm" name="id397760"></a> 889<a class="indexterm" name="id397767"></a> 890 Not all of the mentioned backends may be present on your system or 891 usable (depending on your hardware configuration). One test for all 892 available CUPS backends is provided by the <span class="emphasis"><em>lpinfo</em></span> 893 utility. Used with the <code class="option">-v</code> parameter, it lists 894 all available backends: 895 </p><pre class="screen"> 896 <code class="prompt">$ </code><strong class="userinput"><code>lpinfo -v</code></strong> 897 </pre></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id397802"></a>The Role of <em class="parameter"><code>cupsomatic/foomatic</code></em></h3></div></div></div><p> 898 <a class="indexterm" name="id397814"></a> 899 <a class="indexterm" name="id397821"></a> 900<a class="indexterm" name="id397828"></a> 901<a class="indexterm" name="id397835"></a> 902<a class="indexterm" name="id397842"></a> 903 <em class="parameter"><code>cupsomatic</code></em> filters may be the most widely used on CUPS 904 installations. You must be clear that these were not 905 developed by the CUPS people. They are a third-party add-on to 906 CUPS. They utilize the traditional Ghostscript devices to render jobs 907 for CUPS. When troubleshooting, you should know about the 908 difference. Here the whole rendering process is done in one stage, 909 inside Ghostscript, using an appropriate device for the target 910 printer. <em class="parameter"><code>cupsomatic</code></em> uses PPDs that are generated from the Foomatic 911 Printer & Driver Database at Linuxprinting.org. 912 </p><p> 913 You can recognize these PPDs from the line calling the 914 <em class="parameter"><code>cupsomatic</code></em> filter: 915</p><pre class="programlisting"> 916*cupsFilter: "application/vnd.cups-postscript 0 cupsomatic" 917</pre><p> 918 You may find this line among the first 40 or so lines of the PPD 919 file. If you have such a PPD installed, the printer shows up in the 920 CUPS Web interface with a <em class="parameter"><code>foomatic</code></em> namepart for 921 the driver description. <em class="parameter"><code>cupsomatic</code></em> is a Perl script that runs 922 Ghostscript with all the complicated command-line options 923 autoconstructed from the selected PPD and command line options give to 924 the print job. 925 </p><p> 926 <a class="indexterm" name="id397899"></a> 927<a class="indexterm" name="id397906"></a> 928<a class="indexterm" name="id397912"></a> 929<a class="indexterm" name="id397919"></a> 930<a class="indexterm" name="id397926"></a> 931<a class="indexterm" name="id397933"></a> 932<a class="indexterm" name="id397940"></a> 933<a class="indexterm" name="id397946"></a> 934<a class="indexterm" name="id397953"></a> 935<a class="indexterm" name="id397960"></a> 936<a class="indexterm" name="id397967"></a> 937 However, <em class="parameter"><code>cupsomatic</code></em> is now deprecated. Its PPDs (especially the first 938 generation of them, still in heavy use out there) are not meeting the 939 Adobe specifications. You might also suffer difficulties when you try 940 to download them with “<span class="quote">Point'n'Print</span>” to Windows clients. A better 941 and more powerful successor is now in a stable beta-version: it is called <em class="parameter"><code>foomatic-rip</code></em>. To use 942 <em class="parameter"><code>foomatic-rip</code></em> as a filter with CUPS, you need the new type of PPDs, which 943 have a similar but different line: 944</p><pre class="programlisting"> 945*cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip" 946</pre><p> 947 The PPD-generating engine at Linuxprinting.org has been revamped. 948 The new PPDs comply with the Adobe spec. They also provide a 949 new way to specify different quality levels (hi-res photo, normal 950 color, grayscale, and draft) with a single click, whereas before you 951 could have required five or more different selections (media type, 952 resolution, inktype, and dithering algorithm). There is support for 953 custom-size media built in. There is support to switch 954 print options from page to page in the middle of a job. And the 955 best thing is that the new <code class="constant">foomatic-rip</code> works seamlessly with all 956 legacy spoolers too (like LPRng, BSD-LPD, PDQ, PPR, and so on), providing 957 for them access to use PPDs for their printing. 958 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id398021"></a>The Complete Picture</h3></div></div></div><p> 959 If you want to see an overview of all the filters and how they 960 relate to each other, the complete picture of the puzzle is at the end 961 of this chapter. 962 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id398033"></a><code class="filename">mime.convs</code></h3></div></div></div><p> 963 CUPS autoconstructs all possible filtering chain paths for any given 964 MIME type and every printer installed. But how does it decide in 965 favor of or against a specific alternative? (There may be cases 966 where there is a choice of two or more possible filtering chains for 967 the same target printer.) Simple. You may have noticed the figures in 968 the third column of the mime.convs file. They represent virtual costs 969 assigned to this filter. Every possible filtering chain will sum up to 970 a total “<span class="quote">filter cost.</span>” CUPS decides for the most “<span class="quote">inexpensive</span>” route. 971 </p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p> 972<a class="indexterm" name="id398060"></a> 973<a class="indexterm" name="id398067"></a> 974 Setting <em class="parameter"><code>FilterLimit 1000</code></em> in 975 <code class="filename">cupsd.conf</code> will not allow more filters to 976 run concurrently than will consume a total of 1000 virtual filter 977 cost. This is an efficient way to limit the load of any CUPS 978 server by setting an appropriate “<span class="quote">FilterLimit</span>” value. A FilterLimit of 979 200 allows roughly one job at a time, while a FilterLimit of 1000 allows 980 approximately five jobs maximum at a time. 981 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id398094"></a>“<span class="quote">Raw</span>” Printing</h3></div></div></div><p> 982<a class="indexterm" name="id398104"></a> 983<a class="indexterm" name="id398111"></a> 984<a class="indexterm" name="id398117"></a> 985 You can tell CUPS to print (nearly) any file “<span class="quote">raw</span>”. “<span class="quote">Raw</span>” means it will not be 986 filtered. CUPS will send the file to the printer “<span class="quote">as is</span>” without bothering if the printer is able 987 to digest it. Users need to take care themselves that they send sensible data formats only. Raw printing can 988 happen on any queue if the “<span class="quote"><em class="parameter"><code>-o raw</code></em></span>” option is specified on the command 989 line. You can also set up raw-only queues by simply not associating any PPD with it. This command: 990</p><pre class="screen"> 991<code class="prompt">$ </code><strong class="userinput"><code>lpadmin -P rawprinter -v socket://11.12.13.14:9100 -E</code></strong> 992</pre><p> 993 sets up a queue named “<span class="quote">rawprinter</span>”, connected via the “<span class="quote">socket</span>” protocol (a.k.a. 994 “<span class="quote">HP JetDirect</span>”) to the device at IP address 11.12.1.3.14, using port 9100. (If you had added a 995 PPD with <code class="literal">-P /path/to/PPD</code> to this command line, you would have installed a 996 “<span class="quote">normal</span>” print queue.) 997 </p><p> 998 CUPS will automatically treat each job sent to a queue as a “<span class="quote">raw</span>” one 999 if it can't find a PPD associated with the queue. However, CUPS will 1000 only send known MIME types (as defined in its own mime.types file) and 1001 refuse others. 1002 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id398194"></a>application/octet-stream Printing</h3></div></div></div><p> 1003<a class="indexterm" name="id398202"></a> 1004<a class="indexterm" name="id398209"></a> 1005 Any MIME type with no rule in the <code class="filename">/etc/cups/mime.types</code> file is regarded as unknown 1006 or <em class="parameter"><code>application/octet-stream</code></em> and will not be 1007 sent. Because CUPS refuses to print unknown MIME types by default, 1008 you will probably have experienced that print jobs originating 1009 from Windows clients were not printed. You may have found an error 1010 message in your CUPS logs like: 1011 </p><p><code class="computeroutput"> 1012 Unable to convert file 0 to printable format for job 1013 </code></p><p> 1014 To enable the printing of <em class="parameter"><code>application/octet-stream</code></em> files, edit 1015 these two files: 1016 </p><div class="itemizedlist"><ul type="disc"><li><p><code class="filename">/etc/cups/mime.convs</code></p></li><li><p><code class="filename">/etc/cups/mime.types</code></p></li></ul></div><p> 1017<a class="indexterm" name="id398269"></a> 1018 Both contain entries (at the end of the respective files) that must be uncommented to allow raw mode 1019 operation for <em class="parameter"><code>application/octet-stream</code></em>. In <code class="filename">/etc/cups/mime.types</code> 1020 make sure this line is present: 1021 <a class="indexterm" name="id398290"></a> 1022</p><pre class="programlisting"> 1023application/octet-stream 1024</pre><p> 1025 This line (with no specific autotyping rule set) makes all files 1026 not otherwise auto-typed a member of <em class="parameter"><code>application/octet-stream</code></em>. In 1027 <code class="filename">/etc/cups/mime.convs</code>, have this 1028 line: 1029</p><pre class="programlisting"> 1030application/octet-stream application/vnd.cups-raw 0 - 1031</pre><p> 1032 <a class="indexterm" name="id398322"></a> 1033 This line tells CUPS to use the <span class="emphasis"><em>Null Filter</em></span> 1034 (denoted as “<span class="quote">-</span>”, doing nothing at all) on 1035 <em class="parameter"><code>application/octet-stream</code></em>, and tag the result as 1036 <em class="parameter"><code>application/vnd.cups-raw</code></em>. This last one is 1037 always a green light to the CUPS scheduler to now hand the file over 1038 to the backend connecting to the printer and sending it over. 1039 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 1040 Editing the <code class="filename">mime.convs</code> and the <code class="filename">mime.types</code> file does not 1041 <span class="emphasis"><em>enforce</em></span> “<span class="quote">raw</span>” printing, it only <span class="emphasis"><em>allows</em></span> it. 1042 </p></div><p><b>Background.�</b> 1043<a class="indexterm" name="id398386"></a> 1044<a class="indexterm" name="id398393"></a> 1045<a class="indexterm" name="id398399"></a> 1046<a class="indexterm" name="id398406"></a> 1047 That CUPS is a more security-aware printing system than traditional ones 1048 does not by default allow one to send deliberate (possibly binary) 1049 data to printing devices. (This could be easily abused to launch a 1050 Denial of Service attack on your printer(s), causing at least the loss 1051 of a lot of paper and ink.) “<span class="quote">Unknown</span>” data are regarded by CUPS 1052 as <span class="emphasis"><em>MIME type</em></span> <span class="emphasis"><em>application/octet-stream</em></span>. While you 1053 <span class="emphasis"><em>can</em></span> send data “<span class="quote">raw</span>”, the MIME type for these must 1054 be one that is known to CUPS and allowed by it. The file 1055 <code class="filename">/etc/cups/mime.types</code> defines the “<span class="quote">rules</span>” of how CUPS 1056 recognizes MIME types. The file <code class="filename">/etc/cups/mime.convs</code> decides which file 1057 conversion filter(s) may be applied to which MIME types. 1058 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id398455"></a>PostScript Printer Descriptions for Non-PostScript Printers</h3></div></div></div><p> 1059 <a class="indexterm" name="id398463"></a> 1060<a class="indexterm" name="id398469"></a> 1061<a class="indexterm" name="id398476"></a> 1062<a class="indexterm" name="id398483"></a> 1063<a class="indexterm" name="id398489"></a> 1064<a class="indexterm" name="id398496"></a> 1065 Originally PPDs were meant to be used for PostScript printers 1066 only. Here, they help to send device-specific commands and settings 1067 to the RIP, which processes the job file. CUPS has extended this 1068 scope for PPDs to cover non-PostScript printers too. This was not 1069 difficult, because it is a standardized file format. In a way 1070 it was logical too: CUPS handles PostScript and uses a PostScript 1071 RIP (Ghostscript) to process the job files. The only difference is that 1072 a PostScript printer has the RIP built-in, for other types of 1073 printers the Ghostscript RIP runs on the host computer. 1074 </p><p> 1075 PPDs for a non-PostScript printer have a few lines that are unique to 1076 CUPS. The most important one looks similar to this: 1077 <a class="indexterm" name="id398513"></a> 1078</p><pre class="programlisting"> 1079*cupsFilter: application/vnd.cups-raster 66 rastertoprinter 1080</pre><p> 1081 It is the last piece in the CUPS filtering puzzle. This line tells the 1082 CUPS daemon to use as a last filter <em class="parameter"><code>rastertoprinter</code></em>. This filter 1083 should be served as input an <em class="parameter"><code>application/vnd.cups-raster</code></em> MIME type 1084 file. Therefore, CUPS should autoconstruct a filtering chain, which 1085 delivers as its last output the specified MIME type. This is then 1086 taken as input to the specified <em class="parameter"><code>rastertoprinter</code></em> filter. After 1087 the last filter has done its work (<em class="parameter"><code>rastertoprinter</code></em> is a Gimp-Print 1088 filter), the file should go to the backend, which sends it to the 1089 output device. 1090 </p><p> 1091 CUPS by default ships only a few generic PPDs, but they are good for 1092 several hundred printer models. You may not be able to control 1093 different paper trays, or you may get larger margins than your 1094 specific model supports. See Table 21.1<a href="CUPS-printing.html#cups-ppds" title="Table�22.1.�PPDs Shipped with CUPS">???</a> for summary information. 1095 </p><div class="table"><a name="cups-ppds"></a><p class="title"><b>Table�22.1.�PPDs Shipped with CUPS</b></p><div class="table-contents"><table summary="PPDs Shipped with CUPS" border="1"><colgroup><col align="left"><col align="justify"></colgroup><thead><tr><th align="left">PPD file</th><th align="justify">Printer type</th></tr></thead><tbody><tr><td align="left">deskjet.ppd</td><td align="justify">older HP inkjet printers and compatible</td></tr><tr><td align="left">deskjet2.ppd</td><td align="justify">newer HP inkjet printers and compatible </td></tr><tr><td align="left">dymo.ppd</td><td align="justify">label printers </td></tr><tr><td align="left">epson9.ppd</td><td align="justify">Epson 24-pin impact printers and compatible </td></tr><tr><td align="left">epson24.ppd</td><td align="justify">Epson 24-pin impact printers and compatible </td></tr><tr><td align="left">okidata9.ppd</td><td align="justify">Okidata 9-pin impact printers and compatible </td></tr><tr><td align="left">okidat24.ppd</td><td align="justify">Okidata 24-pin impact printers and compatible </td></tr><tr><td align="left">stcolor.ppd</td><td align="justify">older Epson Stylus Color printers </td></tr><tr><td align="left">stcolor2.ppd</td><td align="justify">newer Epson Stylus Color printers </td></tr><tr><td align="left">stphoto.ppd</td><td align="justify">older Epson Stylus Photo printers </td></tr><tr><td align="left">stphoto2.ppd</td><td align="justify">newer Epson Stylus Photo printers </td></tr><tr><td align="left">laserjet.ppd</td><td align="justify">all PCL printers </td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id398718"></a><span class="emphasis"><em>cupsomatic/foomatic-rip</em></span> Versus <span class="emphasis"><em>Native CUPS</em></span> Printing</h3></div></div></div><p> 1096 <a class="indexterm" name="id398732"></a> 1097 <a class="indexterm" name="id398739"></a> 1098 Native CUPS rasterization works in two steps: 1099 </p><div class="itemizedlist"><ul type="disc"><li><p> 1100<a class="indexterm" name="id398753"></a> 1101 First is the <em class="parameter"><code>pstoraster</code></em> step. It uses the special CUPS 1102 <a class="indexterm" name="id398766"></a> 1103 device from ESP Ghostscript 7.05.x as its tool. 1104 </p></li><li><p> 1105 Second is the <em class="parameter"><code>rasterdriver</code></em> step. It uses various 1106 device-specific filters; there are several vendors who provide good 1107 quality filters for this step. Some are free software, some are 1108 shareware, and some are proprietary. 1109 </p></li></ul></div><p> 1110 Often this produces better quality (and has several more advantages) than other methods. 1111 This is shown in <a href="CUPS-printing.html#cupsomatic-dia" title="Figure�22.10.�cupsomatic/foomatic Processing Versus Native CUPS."> the cupsomatic/foomatic Processing Versus Native CUPS 1112 illustration</a>. 1113 </p><div class="figure"><a name="cupsomatic-dia"></a><p class="title"><b>Figure�22.10.�cupsomatic/foomatic Processing Versus Native CUPS.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/10small.png" alt="cupsomatic/foomatic Processing Versus Native CUPS."></div></div></div><br class="figure-break"><p> 1114 One other method is the <em class="parameter"><code>cupsomatic/foomatic-rip</code></em> 1115 way. Note that <em class="parameter"><code>cupsomatic</code></em> is <span class="emphasis"><em>not</em></span> made by the CUPS 1116 developers. It is an independent contribution to printing development, 1117 made by people from Linuxprinting.org.<sup>[<a name="id398861" href="#ftn.id398861">6</a>]</sup> 1118 <em class="parameter"><code>cupsomatic</code></em> is no longer developed, maintained, or supported. It now been 1119 replaced by <em class="parameter"><code>foomatic-rip</code></em>. <em class="parameter"><code>foomatic-rip</code></em> is a complete rewrite 1120 of the old <em class="parameter"><code>cupsomatic</code></em> idea, but very much improved and generalized to 1121 other (non-CUPS) spoolers. An upgrade to <em class="parameter"><code>foomatic-rip</code></em> is strongly 1122 advised, especially if you are upgrading to a recent version of CUPS, 1123 too. 1124 </p><p> 1125 <a class="indexterm" name="id398907"></a> 1126 <a class="indexterm" name="id398914"></a> 1127 Like the old <em class="parameter"><code>cupsomatic</code></em> method, the <em class="parameter"><code>foomatic-rip</code></em> (new) method 1128 from Linuxprinting.org uses the traditional Ghostscript print file processing, doing everything in a single 1129 step. It therefore relies on all the other devices built into Ghostscript. The quality is as good (or bad) as 1130 Ghostscript rendering is in other spoolers. The advantage is that this method supports many printer models not 1131 supported (yet) by the more modern CUPS method. 1132 </p><p> 1133 Of course, you can use both methods side by side on one system (and even for one printer, if you set up 1134 different queues) and find out which works best for you. 1135 </p><p> 1136<a class="indexterm" name="id398944"></a> 1137<a class="indexterm" name="id398951"></a> 1138<a class="indexterm" name="id398958"></a> 1139<a class="indexterm" name="id398964"></a> 1140<a class="indexterm" name="id398971"></a> 1141<a class="indexterm" name="id398978"></a> 1142 <em class="parameter"><code>cupsomatic</code></em> kidnaps the print file after the 1143 <em class="parameter"><code>application/vnd.cups-postscript</code></em> stage and deviates it through the CUPS-external, 1144 systemwide Ghostscript installation. Therefore, the print file bypasses the <em class="parameter"><code>pstoraster</code></em> 1145 filter (and also bypasses the CUPS raster drivers <em class="parameter"><code>rastertosomething</code></em>). After Ghostscript 1146 finished its rasterization, <em class="parameter"><code>cupsomatic</code></em> hands the rendered file directly to the CUPS 1147 backend. <a href="CUPS-printing.html#cupsomatic-dia" title="Figure�22.10.�cupsomatic/foomatic Processing Versus Native CUPS.">cupsomatic/foomatic Processing Versus Native 1148 CUPS</a>, illustrates the difference between native CUPS rendering and the 1149 <em class="parameter"><code>Foomatic/cupsomatic</code></em> method. 1150 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id399033"></a>Examples for Filtering Chains</h3></div></div></div><p> 1151 Here are a few examples of commonly occurring filtering chains to 1152 illustrate the workings of CUPS. 1153 </p><p> 1154<a class="indexterm" name="id399045"></a> 1155<a class="indexterm" name="id399052"></a> 1156<a class="indexterm" name="id399058"></a> 1157<a class="indexterm" name="id399065"></a> 1158 Assume you want to print a PDF file to an HP JetDirect-connected 1159 PostScript printer, but you want to print pages 3-5, 7, and 11-13 1160 only, and you want to print them “<span class="quote">two-up</span>” and “<span class="quote">duplex</span>”: 1161 </p><div class="itemizedlist"><ul type="disc"><li><p>Your print options (page selection as required, two-up, 1162 duplex) are passed to CUPS on the command line.</p></li><li><p>The (complete) PDF file is sent to CUPS and autotyped as 1163 <em class="parameter"><code>application/pdf</code></em>.</p></li><li><p>The file therefore must first pass the 1164 <em class="parameter"><code>pdftops</code></em> prefilter, which produces PostScript 1165 MIME type <em class="parameter"><code>application/postscript</code></em> (a preview here 1166 would still show all pages of the original PDF).</p></li><li><p>The file then passes the <em class="parameter"><code>pstops</code></em> 1167 filter that applies the command-line options: it selects pages 1168 2-5, 7, and 11-13, creates the imposed layout “<span class="quote">two pages on one sheet</span>”, and 1169 inserts the correct “<span class="quote">duplex</span>” command (as defined in the printer's 1170 PPD) into the new PostScript file; the file is now of PostScript MIME 1171 type 1172 <em class="parameter"><code>application/vnd.cups-postscript</code></em>.</p></li><li><p>The file goes to the <em class="parameter"><code>socket</code></em> 1173 backend, which transfers the job to the printers.</p></li></ul></div><p> 1174 The resulting filter chain, therefore, is as shown in <a href="CUPS-printing.html#pdftosocket" title="Figure�22.11.�PDF to Socket Chain.">the PDF to socket chain 1175 illustration</a>. 1176 </p><a class="indexterm" name="id399167"></a><div class="figure"><a name="pdftosocket"></a><p class="title"><b>Figure�22.11.�PDF to Socket Chain.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/pdftosocket.png" alt="PDF to Socket Chain."></div></div></div><br class="figure-break"><p> 1177<a class="indexterm" name="id399215"></a> 1178<a class="indexterm" name="id399222"></a> 1179<a class="indexterm" name="id399229"></a> 1180 Assume you want to print the same filter to an USB-connected Epson Stylus Photo Printer installed with the CUPS 1181 <code class="filename">stphoto2.ppd</code>. The first few filtering stages are nearly the same: 1182 </p><div class="itemizedlist"><ul type="disc"><li><p> 1183 Your print options (page selection as required, two-up, 1184 duplex) are passed to CUPS on the command line. 1185 </p></li><li><p> 1186 The (complete) PDF file is sent to CUPS and autotyped as 1187 <em class="parameter"><code>application/pdf</code></em>. 1188 </p></li><li><p> 1189<a class="indexterm" name="id399266"></a> 1190<a class="indexterm" name="id399272"></a> 1191 The file must first pass the <em class="parameter"><code>pdftops</code></em> prefilter, which produces PostScript 1192 MIME type <em class="parameter"><code>application/postscript</code></em> (a preview here would still show all 1193 pages of the original PDF). 1194 </p></li><li><p> 1195<a class="indexterm" name="id399296"></a> 1196<a class="indexterm" name="id399303"></a> 1197 The file then passes the “<span class="quote">pstops</span>” filter that applies 1198 the command-line options: it selects the pages 2-5, 7, and 11-13, 1199 creates the imposed layout “<span class="quote">two pages on one sheet,</span>” and inserts the 1200 correct “<span class="quote">duplex</span>” command (oops this printer and PPD 1201 do not support duplex printing at all, so this option will 1202 be ignored) into the new PostScript file; the file is now of PostScript 1203 MIME type <em class="parameter"><code>application/vnd.cups-postscript</code></em>. 1204 </p></li><li><p> 1205 The file then passes the <em class="parameter"><code>pstoraster</code></em> stage and becomes MIME type 1206 <em class="parameter"><code>application/cups-raster</code></em>. 1207 </p></li><li><p> 1208<a class="indexterm" name="id399354"></a> 1209 Finally, the <em class="parameter"><code>rastertoepson</code></em> filter 1210 does its work (as indicated in the printer's PPD), creating the 1211 printer-specific raster data and embedding any user-selected 1212 print options into the print data stream. 1213 </p></li><li><p> 1214 The file goes to the <em class="parameter"><code>usb</code></em> backend, which transfers the job to the printers. 1215 </p></li></ul></div><p> 1216 The resulting filter chain therefore is as shown in <a href="CUPS-printing.html#pdftoepsonusb" title="Figure�22.12.�PDF to USB Chain.">the PDF to USB Chain 1217 illustration</a>. 1218 </p><div class="figure"><a name="pdftoepsonusb"></a><p class="title"><b>Figure�22.12.�PDF to USB Chain.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/pdftoepsonusb.png" alt="PDF to USB Chain."></div></div></div><br class="figure-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id399434"></a>Sources of CUPS Drivers/PPDs</h3></div></div></div><p> 1219 On the Internet you can now find many thousands of CUPS-PPD files 1220 (with their companion filters), in many national languages 1221 supporting more than 1,000 non-PostScript models. 1222 </p><div class="itemizedlist"><a class="indexterm" name="id399447"></a><a class="indexterm" name="id399456"></a><ul type="disc"><li><p> 1223 <a href="http://www.easysw.com/printpro/" target="_top">ESP PrintPro</a> 1224 (commercial, non-free) is packaged with more than 3,000 PPDs, ready for 1225 successful use “<span class="quote">out of the box</span>” on Linux, Mac OS X, IBM-AIX, 1226 HP-UX, Sun-Solaris, SGI-IRIX, Compaq Tru64, Digital UNIX, and 1227 other commercial Unices (it is written by the CUPS developers 1228 themselves and its sales help finance the further development of 1229 CUPS, as they feed their creators). 1230 </p></li><li><p> 1231 The <a href="http://gimp-print.sourceforge.net/" target="_top">Gimp-Print Project</a> 1232 (GPL, free software) provides around 140 PPDs (supporting nearly 400 printers, many driven 1233 to photo quality output), to be used alongside the Gimp-Print CUPS filters. 1234 </p></li><li><p> 1235 <a href="http://www.turboprint.de/english.html/" target="_top">TurboPrint </a> (shareware, non-free) supports 1236 roughly the same number of printers in excellent quality. 1237 </p></li><li><p> 1238 <a href="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/" target="_top">OMNI </a> 1239 (LPGL, free) is a package made by IBM, now containing support for more 1240 than 400 printers, stemming from the inheritance of IBM OS/2 know-how 1241 ported over to Linux (CUPS support is in a beta stage at present). 1242 </p></li><li><p> 1243 <a href="http://hpinkjet.sourceforge.net/" target="_top">HPIJS </a> (BSD-style licenses, free) 1244 supports approximately 150 of HP's own printers and also provides 1245 excellent print quality now (currently available only via the Foomatic path). 1246 </p></li><li><p> 1247 <a href="http://www.linuxprinting.org/" target="_top">Foomatic/cupsomatic </a> 1248 (LPGL, free) from Linuxprinting.org provide PPDs for practically every Ghostscript 1249 filter known to the world (including Omni, Gimp-Print, and HPIJS). 1250 </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id399543"></a>Printing with Interface Scripts</h3></div></div></div><p> 1251<a class="indexterm" name="id399551"></a> 1252<a class="indexterm" name="id399557"></a> 1253 CUPS also supports the use of “<span class="quote">interface scripts</span>” as known from 1254 System V AT&T printing systems. These are often used for PCL 1255 printers, from applications that generate PCL print jobs. Interface 1256 scripts are specific to printer models. They have a role similar to 1257 PPDs for PostScript printers. Interface scripts may inject the Escape 1258 sequences as required into the print data stream if the user, for example, selects 1259 a certain paper tray, or changes paper orientation, or uses A3 1260 paper. Interface scripts are practically unknown in the Linux 1261 realm. On HP-UX platforms they are more often used. You can use any 1262 working interface script on CUPS too. Just install the printer with 1263 the <code class="literal">-i</code> option: 1264</p><pre class="screen"> 1265<code class="prompt">root# </code><strong class="userinput"><code>lpadmin -p pclprinter -v socket://11.12.13.14:9100 \ 1266 -i /path/to/interface-script</code></strong> 1267</pre><p> 1268 Interface scripts might be the “<span class="quote">unknown animal</span>” to many. However, 1269 with CUPS they provide the easiest way to plug in your own custom-written filtering 1270 script or program into one specific print queue (some information about the traditional 1271 use of interface scripts is found at 1272 <a href="http://playground.sun.com/printing/documentation/interface.html" target="_top"> 1273 http://playground.sun.com/printing/documentation/interface.html</a>). 1274 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id399622"></a>Network Printing (Purely Windows)</h2></div></div></div><p> 1275Network printing covers a lot of ground. To understand what exactly 1276goes on with Samba when it is printing on behalf of its Windows 1277clients, let's first look at a “<span class="quote">purely Windows</span>” setup: Windows clients 1278with a Windows NT print server. 1279</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id399636"></a>From Windows Clients to an NT Print Server</h3></div></div></div><p> 1280Windows clients printing to an NT-based print server have two 1281options. They may: 1282<a class="indexterm" name="id399645"></a> 1283<a class="indexterm" name="id399652"></a> 1284</p><div class="itemizedlist"><ul type="disc"><li><p>Execute the driver locally and render the GDI output 1285 (EMF) into the printer-specific format on their own. 1286 </p></li><li><p>Send the GDI output (EMF) to the server, where the 1287 driver is executed to render the printer-specific output. 1288 </p></li></ul></div><p> 1289Both print paths are shown in the flowcharts in <a href="CUPS-printing.html#small11" title="Figure�22.13.�Print Driver Execution on the Client."> 1290Print Driver Execution on the Client</a>, and 1291<a href="CUPS-printing.html#small12" title="Figure�22.14.�Print Driver Execution on the Server.">Print Driver Execution on the Server</a>. 1292</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id399694"></a>Driver Execution on the Client</h3></div></div></div><p> 1293In the first case, the print server must spool the file as raw, meaning it shouldn't touch the job file and try 1294to convert it in any way. This is what a traditional UNIX-based print server can do too, and at a better 1295performance and more reliably than an NT print server. This is what most Samba administrators probably are 1296familiar with. One advantage of this setup is that this “<span class="quote">spooling-only</span>” print server may be used 1297even if no driver(s) for UNIX is available. It is sufficient to have the Windows client drivers available and 1298installed on the clients. This is illustrated in <a href="CUPS-printing.html#small11" title="Figure�22.13.�Print Driver Execution on the Client.">the Print Driver Execution on the 1299Client diagram</a>. 1300</p><div class="figure"><a name="small11"></a><p class="title"><b>Figure�22.13.�Print Driver Execution on the Client.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/11small.png" alt="Print Driver Execution on the Client."></div></div></div><br class="figure-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id399759"></a>Driver Execution on the Server</h3></div></div></div><p> 1301<a class="indexterm" name="id399767"></a> 1302<a class="indexterm" name="id399774"></a> 1303<a class="indexterm" name="id399780"></a> 1304<a class="indexterm" name="id399787"></a> 1305<a class="indexterm" name="id399794"></a> 1306The other path executes the printer driver on the server. The client transfers print files in EMF format to 1307the server. The server uses the PostScript, PCL, ESC/P, or other driver to convert the EMF file into the 1308printer-specific language. It is not possible for UNIX to do the same. Currently, there is no program or 1309method to convert a Windows client's GDI output on a UNIX server into something a printer could understand. 1310This is illustrated in <a href="CUPS-printing.html#small12" title="Figure�22.14.�Print Driver Execution on the Server.">the Print Driver Execution on the Server diagram</a>. 1311</p><div class="figure"><a name="small12"></a><p class="title"><b>Figure�22.14.�Print Driver Execution on the Server.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/12small.png" alt="Print Driver Execution on the Server."></div></div></div><br class="figure-break"><p> 1312However, something similar is possible with CUPS, so read on. 1313</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id399858"></a>Network Printing (Windows Clients and UNIX/Samba Print 1314Servers)</h2></div></div></div><p> 1315Since UNIX print servers <span class="emphasis"><em>cannot</em></span> execute the Win32 1316program code on their platform, the picture is somewhat 1317different. However, this does not limit your options all that 1318much. On the contrary, you may have a way here to implement printing 1319features that are not possible otherwise. 1320</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id399874"></a>From Windows Clients to a CUPS/Samba Print Server</h3></div></div></div><p> 1321Here is a simple recipe showing how you can take advantage of CUPS's 1322powerful features for the benefit of your Windows network printing 1323clients: 1324</p><div class="itemizedlist"><ul type="disc"><li><p>Let the Windows clients send PostScript to the CUPS 1325 server.</p></li><li><p>Let the CUPS server render the PostScript into device-specific raster format.</p></li></ul></div><p> 1326This requires the clients to use a PostScript driver (even if the 1327printer is a non-PostScript model. It also requires that you have a 1328driver on the CUPS server. 1329</p><p> 1330First, to enable CUPS-based printing through Samba, the following options should be set in your <code class="filename">smb.conf</code> 1331file <em class="parameter"><code>[global]</code></em> section: 1332</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id399924"></a><em class="parameter"><code>printing = cups</code></em></td></tr><tr><td><a class="indexterm" name="id399936"></a><em class="parameter"><code>printcap = cups</code></em></td></tr></table><p> 1333When these parameters are specified, all manually set print directives (like <a class="indexterm" name="id399952"></a>print command or <a class="indexterm" name="id399959"></a>lppause command) in <code class="filename">smb.conf</code> (as well as in Samba itself) will be 1334ignored. Instead, Samba will directly interface with CUPS through its application program interface (API), as 1335long as Samba has been compiled with CUPS library (libcups) support. If Samba has not been compiled with CUPS 1336support, and if no other print commands are set up, then printing will use the <span class="emphasis"><em>System V</em></span> 1337AT&T command set, with the -oraw option automatically passing through (if you want your own defined print 1338commands to work with a Samba server that has CUPS support compiled in, simply use <a class="indexterm" name="id399981"></a>classicalprinting = sysv). This is illustrated in <a href="CUPS-printing.html#13small" title="Figure�22.15.�Printing via CUPS/Samba Server.">the Printing via 1339CUPS/Samba Server diagram</a>. 1340</p><div class="figure"><a name="13small"></a><p class="title"><b>Figure�22.15.�Printing via CUPS/Samba Server.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/13small.png" alt="Printing via CUPS/Samba Server."></div></div></div><br class="figure-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id400039"></a>Samba Receiving Job-Files and Passing Them to CUPS</h3></div></div></div><p> 1341Samba <span class="emphasis"><em>must</em></span> use its own spool directory (it is set by a line similar to <a class="indexterm" name="id400052"></a>path = /var/spool/samba, in the <em class="parameter"><code>[printers]</code></em> or <em class="parameter"><code>[printername]</code></em> section of <code class="filename">smb.conf</code>). Samba receives the job in its own spool space and passes it 1342into the spool directory of CUPS (the CUPS spool directory is set by the <em class="parameter"><code>RequestRoot</code></em> 1343directive in a line that defaults to <em class="parameter"><code>RequestRoot /var/spool/cups</code></em>). CUPS checks the 1344access rights of its spool directory and resets it to healthy values with every restart. We have seen quite a 1345few people who used a common spooling space for Samba and CUPS, and struggled for weeks with this 1346“<span class="quote">problem.</span>” 1347</p><p> 1348A Windows user authenticates only to Samba (by whatever means is 1349configured). If Samba runs on the same host as CUPS, you only need to 1350allow “<span class="quote">localhost</span>” to print. If it runs on different machines, you 1351need to make sure the Samba host gets access to printing on CUPS. 1352</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id400108"></a>Network PostScript RIP</h2></div></div></div><p> 1353This section discusses the use of CUPS filters on the server configuration where 1354clients make use of a PostScript driver with CUPS-PPDs. 1355</p><p> 1356<a class="indexterm" name="id400122"></a> 1357<a class="indexterm" name="id400129"></a> 1358<a class="indexterm" name="id400136"></a> 1359PPDs can control all print device options. They are usually provided by the manufacturer if you own 1360a PostScript printer, that is. PPD files are always a component of PostScript printer drivers on MS Windows or 1361Apple Mac OS systems. They are ASCII files containing user-selectable print options, mapped to appropriate 1362PostScript, PCL, or PJL commands for the target printer. Printer driver GUI dialogs translate these options 1363“<span class="quote">on the fly</span>” into buttons and drop-down lists for the user to select. 1364</p><p> 1365CUPS can load, without any conversions, the PPD file from any Windows (NT is recommended) PostScript driver 1366and handle the options. There is a Web browser interface to the print options (select <a href="http://localhost:631/printers/" target="_top">http://localhost:631/printers/</a> and click on one 1367<span class="guibutton">Configure Printer</span> button to see it) or a command-line interface (see <code class="literal">man 1368lpoptions</code> or see if you have <code class="literal">lphelp</code> on your system). There are also some 1369different GUI front-ends on Linux/UNIX, which can present PPD options to users. PPD options are normally meant 1370to be evaluated by the PostScript RIP on the real PostScript printer. 1371</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id400187"></a>PPDs for Non-PS Printers on UNIX</h3></div></div></div><p> 1372<a class="indexterm" name="id400195"></a> 1373CUPS does not limit itself to “<span class="quote">real</span>” PostScript printers in its use of PPDs. The CUPS developers 1374have extended the scope of the PPD concept to also describe available device and driver options for 1375non-PostScript printers through CUPS-PPDs. 1376</p><p> 1377This is logical, because CUPS includes a fully featured PostScript interpreter (RIP). This RIP is based on 1378Ghostscript. It can process all received PostScript (and additionally many other file formats) from clients. 1379All CUPS-PPDs geared to non-PostScript printers contain an additional line, starting with the keyword 1380<em class="parameter"><code>*cupsFilter</code></em>. This line tells the CUPS print system which printer-specific filter to use 1381for the interpretation of the supplied PostScript. Thus CUPS lets all its printers appear as PostScript 1382devices to its clients, because it can act as a PostScript RIP for those printers, processing the received 1383PostScript code into a proper raster print format. 1384</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id400224"></a>PPDs for Non-PS Printers on Windows</h3></div></div></div><p> 1385<a class="indexterm" name="id400232"></a> 1386CUPS-PPDs can also be used on Windows clients, on top of a “<span class="quote">core</span>” PostScript driver (now 1387recommended is the CUPS PostScript Driver for Windows NT/200x/XP; you can also use the Adobe one, with 1388limitations). This feature enables CUPS to do a few tricks no other spooler can do: 1389</p><div class="itemizedlist"><ul type="disc"><li><p> 1390 Act as a networked PostScript RIP handling print files from all client platforms in a uniform way. 1391 </p></li><li><p> 1392 Act as a central accounting and billing server, since all files are passed through the pstops filter and are therefore 1393 logged in the CUPS <code class="filename">page_log</code> file. <span class="emphasis"><em>Note:</em></span> this cannot happen with 1394 “<span class="quote">raw</span>” print jobs, which always remain unfiltered per definition. 1395 </p></li><li><p> 1396 Enable clients to consolidate on a single PostScript driver, even for many different target printers. 1397 </p></li></ul></div><p> 1398Using CUPS PPDs on Windows clients enables them to control all print job settings just as a UNIX client can do. 1399</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id400285"></a>Windows Terminal Servers (WTS) as CUPS Clients</h2></div></div></div><p> 1400This setup may be of special interest to people experiencing major problems in WTS environments. WTS often 1401need a multitude of non-PostScript drivers installed to run their clients' variety of different printer 1402models. This often imposes the price of much increased instability. 1403</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id400296"></a>Printer Drivers Running in “<span class="quote">Kernel Mode</span>” Cause Many 1404Problems</h3></div></div></div><p> 1405Windows NT printer drivers, which run in “<span class="quote">kernel mode</span>”, introduce a high risk for the stability 1406of the system if the driver is not really stable and well-tested. And there are a lot of bad drivers out 1407there! Especially notorious is the example of the PCL printer driver that had an additional sound module 1408running to notify users via soundcard of their finished jobs. Do I need to say that this one was also reliably 1409causing “<span class="quote">blue screens of death</span>” on a regular basis? 1410</p><p> 1411PostScript drivers are generally well-tested. They are not known to cause any problems, even though they also 1412run in kernel mode. This might be because until now there have been only two different PostScript drivers: the 1413one from Adobe and the one from Microsoft. Both are well-tested and are as stable as you can imagine on 1414Windows. The CUPS driver is derived from the Microsoft one. 1415</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id400328"></a>Workarounds Impose Heavy Limitations</h3></div></div></div><p> 1416In an attempt to work around problems, site administrators have resorted to restricting the 1417allowed drivers installed on their WTS to one generic PCL and one PostScript driver. This, however, restricts 1418the number of printer options available for clients to use. Often they can't get out more than simplex 1419prints from one standard paper tray, while their devices could do much better if driven by a different driver! 1420</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id400341"></a>CUPS: A “<span class="quote">Magical Stone</span>”?</h3></div></div></div><p> 1421<a class="indexterm" name="id400352"></a> 1422<a class="indexterm" name="id400359"></a> 1423Using a PostScript driver, enabled with a CUPS-PPD, seems to be a very elegant way to overcome all these 1424shortcomings. There are, depending on the version of Windows OS you use, up to three different PostScript 1425drivers now available: Adobe, Microsoft, and CUPS PostScript drivers. None of them is known to cause major 1426stability problems on WTS (even if used with many different PPDs). The clients will be able to (again) choose 1427paper trays, duplex printing, and other settings. However, there is a certain price for this too: a CUPS 1428server acting as a PostScript RIP for its clients requires more CPU and RAM than when just acting as a 1429“<span class="quote">raw spooling</span>” device. Plus, this setup is not yet widely tested, although the first feedbacks 1430look very promising. 1431</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id400378"></a>PostScript Drivers with No Major Problems, Even in Kernel 1432Mode</h3></div></div></div><p> 1433<a class="indexterm" name="id400386"></a> 1434<a class="indexterm" name="id400393"></a> 1435<a class="indexterm" name="id400400"></a> 1436<a class="indexterm" name="id400406"></a> 1437<a class="indexterm" name="id400413"></a> 1438<a class="indexterm" name="id400420"></a> 1439More recent printer drivers on W200x and XP no longer run in kernel mode (unlike Windows NT). However, both 1440operating systems can still use the NT drivers, running in kernel mode (you can roughly tell which is which as 1441the drivers in subdirectory “<span class="quote">2</span>” of “<span class="quote">W32X86</span>” are “<span class="quote">old</span>” ones). As was 1442said before, the Adobe as well as the Microsoft PostScript drivers are not known to cause any stability 1443problems. The CUPS driver is derived from the Microsoft one. There is a simple reason for this: the MS DDK 1444(Device Development Kit) for Windows NT (which used to be available at no cost to licensees of Visual Studio) 1445includes the source code of the Microsoft driver, and licensees of Visual Studio are allowed to use and modify 1446it for their own driver development efforts. This is what the CUPS people have done. The license does not 1447allow them to publish the whole of the source code. However, they have released the “<span class="quote">diff</span>” under 1448the GPL, and if you are the owner of an “<span class="quote">MS DDK for Windows NT,</span>” you can check the driver 1449yourself. 1450</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id400456"></a>Configuring CUPS for Driver Download</h2></div></div></div><p> 1451As we have said before, all previously known methods to prepare client printer drivers on the Samba server for 1452download and Point'n'Print convenience of Windows workstations are working with CUPS, too. These methods were 1453described in <a href="classicalprinting.html" title="Chapter�21.�Classical Printing Support">Classical Printing</a>. In reality, this is a pure Samba 1454business and relates only to the Samba-Windows client relationship. 1455</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id400475"></a><span class="emphasis"><em>cupsaddsmb</em></span>: The Unknown Utility</h3></div></div></div><p> 1456<a class="indexterm" name="id400485"></a> 1457The <em class="parameter"><code>cupsaddsmb</code></em> utility (shipped with all current CUPS versions) is an alternative 1458method to transfer printer drivers into the Samba <em class="parameter"><code>[print$]</code></em> share. Remember, this 1459share is where clients expect drivers deposited and set up for download and installation. It makes the sharing 1460of any (or all) installed CUPS printers quite easy. <code class="literal">cupsaddsmb</code> can use the Adobe PostScript 1461driver as well as the newly developed CUPS PostScript driver for Windows NT/200x/XP. 1462<em class="parameter"><code>cupsaddsmb</code></em> does <span class="emphasis"><em>not</em></span> work with arbitrary vendor printer drivers, 1463but only with the <span class="emphasis"><em>exact</em></span> driver files that are named in its man page. 1464</p><p> 1465The CUPS printer driver is available from the CUPS download site. Its package name is 1466<code class="filename">cups-samba-[version].tar.gz</code>. It is preferred over the Adobe drivers because it has a 1467number of advantages: 1468</p><div class="itemizedlist"><ul type="disc"><li><p>It supports a much more accurate page accounting.</p></li><li><p>It supports banner pages and page labels on all printers.</p></li><li><p>It supports the setting of a number of job IPP attributes 1469 (such as job priority, page label, and job billing).</p></li></ul></div><p> 1470However, currently only Windows NT, 2000, and XP are supported by the 1471CUPS drivers. You will also need to get the respective part of the Adobe driver 1472if you need to support Windows 95, 98, and Me clients. 1473</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id400563"></a>Prepare Your <code class="filename">smb.conf</code> for <code class="literal">cupsaddsmb</code></h3></div></div></div><p> 1474Prior to running <code class="literal">cupsaddsmb</code>, you need the settings in 1475<code class="filename">smb.conf</code> as shown in <a href="CUPS-printing.html#cupsadd-ex" title="Example�22.3.�smb.conf for cupsaddsmb Usage">the <code class="filename">smb.conf</code> for cupsaddsmb Usage</a>. 1476</p><div class="example"><a name="cupsadd-ex"></a><p class="title"><b>Example�22.3.�smb.conf for cupsaddsmb Usage</b></p><div class="example-contents"><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id400631"></a><em class="parameter"><code>load printers = yes</code></em></td></tr><tr><td><a class="indexterm" name="id400644"></a><em class="parameter"><code>printing = cups</code></em></td></tr><tr><td><a class="indexterm" name="id400656"></a><em class="parameter"><code>printcap name = cups</code></em></td></tr><tr><td> </td></tr><tr><td><em class="parameter"><code>[printers]</code></em></td></tr><tr><td><a class="indexterm" name="id400678"></a><em class="parameter"><code>comment = All Printers</code></em></td></tr><tr><td><a class="indexterm" name="id400690"></a><em class="parameter"><code>path = /var/spool/samba</code></em></td></tr><tr><td><a class="indexterm" name="id400703"></a><em class="parameter"><code>browseable = no</code></em></td></tr><tr><td><a class="indexterm" name="id400715"></a><em class="parameter"><code>public = yes</code></em></td></tr><tr><td># setting depends on your requirements</td></tr><tr><td><a class="indexterm" name="id400731"></a><em class="parameter"><code>guest ok = yes</code></em></td></tr><tr><td><a class="indexterm" name="id400744"></a><em class="parameter"><code>writable = no</code></em></td></tr><tr><td><a class="indexterm" name="id400756"></a><em class="parameter"><code>printable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id400769"></a><em class="parameter"><code>printer admin = root</code></em></td></tr><tr><td> </td></tr><tr><td><em class="parameter"><code>[print$]</code></em></td></tr><tr><td><a class="indexterm" name="id400790"></a><em class="parameter"><code>comment = Printer Drivers</code></em></td></tr><tr><td><a class="indexterm" name="id400803"></a><em class="parameter"><code>path = /etc/samba/drivers</code></em></td></tr><tr><td><a class="indexterm" name="id400816"></a><em class="parameter"><code>browseable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id400828"></a><em class="parameter"><code>guest ok = no</code></em></td></tr><tr><td><a class="indexterm" name="id400841"></a><em class="parameter"><code>read only = yes</code></em></td></tr><tr><td><a class="indexterm" name="id400853"></a><em class="parameter"><code>write list = root</code></em></td></tr></table></div></div><br class="example-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id400868"></a>CUPS “<span class="quote">PostScript Driver for Windows NT/200x/XP</span>”</h3></div></div></div><p> 1477<a class="indexterm" name="id400878"></a> 1478CUPS users may get the exact same package from <a href="http://www.cups.org/software.html" target="_top">http://www.cups.org/software.html</a>. It is a separate package 1479from the CUPS-based software files, tagged as CUPS 1.1.x Windows NT/200x/XP Printer Driver for Samba (tar.gz, 1480192k). The filename to download is <code class="filename">cups-samba-1.1.x.tar.gz</code>. Upon untar and unzipping, it 1481will reveal these files: 1482</p><pre class="screen"> 1483<code class="prompt">root# </code><strong class="userinput"><code>tar xvzf cups-samba-1.1.19.tar.gz</code></strong> 1484cups-samba.install 1485cups-samba.license 1486cups-samba.readme 1487cups-samba.remove 1488cups-samba.ss 1489</pre><p> 1490<a class="indexterm" name="id400921"></a> 1491<a class="indexterm" name="id400930"></a> 1492These have been packaged with the ESP meta-packager software EPM. The <code class="filename">*.install</code> and 1493<code class="filename">*.remove</code> files are simple shell scripts, which untar the <code class="filename">*.ss</code> (the 1494<code class="filename">*.ss</code> is nothing else but a tar archive, which can be untarred by “<span class="quote">tar</span>” too). 1495Then it puts the content into <code class="filename">/usr/share/cups/drivers/</code>. This content includes three 1496files: 1497</p><pre class="screen"> 1498<code class="prompt">root# </code><strong class="userinput"><code>tar tv cups-samba.ss</code></strong> 1499cupsdrvr.dll 1500cupsui.dll 1501cups.hlp 1502</pre><p> 1503The <em class="parameter"><code>cups-samba.install</code></em> shell scripts are easy to 1504handle: 1505</p><pre class="screen"> 1506<code class="prompt">root# </code><strong class="userinput"><code>./cups-samba.install</code></strong> 1507[....] 1508Installing software... 1509Updating file permissions... 1510Running post-install commands... 1511Installation is complete. 1512</pre><p> 1513The script should automatically put the driver files into the 1514<code class="filename">/usr/share/cups/drivers/</code> directory: 1515</p><pre class="screen"> 1516<code class="prompt">root# </code><strong class="userinput"><code>cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/</code></strong> 1517</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p> 1518Due to a bug, one recent CUPS release puts the <code class="filename">cups.hlp</code> driver file 1519into<code class="filename">/usr/share/drivers/</code> instead of <code class="filename">/usr/share/cups/drivers/</code>. To work 1520around this, copy/move the file (after running the <code class="literal">./cups-samba.install</code> script) manually to 1521the correct place. 1522</p></div><p> 1523<a class="indexterm" name="id401073"></a> 1524This new CUPS PostScript driver is currently binary only, but free of charge. No complete source code is 1525provided (yet). The reason is that it has been developed with the help of the Microsoft DDK and compiled with 1526Microsoft Visual Studio 6. Driver developers are not allowed to distribute the whole of the source code as 1527free software. However, CUPS developers released the “<span class="quote">diff</span>” in source code under the GPL, so 1528anybody with a license for Visual Studio and a DDK will be able to compile for himself or herself. 1529</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id401090"></a>Recognizing Different Driver Files</h3></div></div></div><p> 1530The CUPS drivers do not support the older Windows 95/98/Me, but only the Windows NT/2000/XP client. 1531</p><p>Windows NT, 2000, and XP are supported by:</p><div class="itemizedlist"><ul type="disc"><li><p>cups.hlp</p></li><li><p>cupsdrvr.dll</p></li><li><p>cupsui.dll</p></li></ul></div><p> 1532Adobe drivers are available for the older Windows 95/98/Me as well as 1533for Windows NT/2000/XP clients. The set of files is different from the 1534different platforms. 1535</p><p>Windows 95, 98, and ME are supported by:</p><div class="itemizedlist"><ul type="disc"><li><p>ADFONTS.MFM</p></li><li><p>ADOBEPS4.DRV</p></li><li><p>ADOBEPS4.HLP</p></li><li><p>DEFPRTR2.PPD</p></li><li><p>ICONLIB.DLL</p></li><li><p>PSMON.DLL</p></li></ul></div><p>Windows NT, 2000, and XP are supported by:</p><div class="itemizedlist"><ul type="disc"><li><p>ADOBEPS5.DLL</p></li><li><p>ADOBEPSU.DLL</p></li><li><p>ADOBEPSU.HLP</p></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 1536<a class="indexterm" name="id401182"></a> 1537If both the Adobe driver files and the CUPS driver files for the support of Windows NT/200x/XP are presently 1538installed on the server, the Adobe files will be ignored and the CUPS files will be used. If you prefer 1539 for whatever reason to use Adobe-only drivers, move away the three CUPS driver files. 1540The Windows 9x/Me clients use the Adobe drivers in any case. 1541</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id401201"></a>Acquiring the Adobe Driver Files</h3></div></div></div><p> 1542Acquiring the Adobe driver files seems to be unexpectedly difficult for many users. They are not available on 1543the Adobe Web site as single files, and the self-extracting and/or self-installing Windows-.exe is not easy to 1544locate either. You probably need to use the included native installer and run the installation process on one 1545client once. This will install the drivers (and one generic PostScript printer) locally on the client. When 1546they are installed, share the generic PostScript printer. After this, the client's <em class="parameter"><code>[print$]</code></em> share holds the Adobe files, which you can get with smbclient from the CUPS host. 1547</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id401221"></a>ESP Print Pro PostScript Driver for Windows NT/200x/XP</h3></div></div></div><p> 1548<a class="indexterm" name="id401229"></a> 1549Users of the ESP Print Pro software are able to install the ESP print drivers package as an alternative to the 1550Adobe PostScript drivers. To do so, retrieve the driver files from the normal download area of the ESP Print 1551Pro software at <a href="http://www.easysw.com/software.html" target="_top">Easy Software</a> web site. 1552You need to locate the link labeled “<span class="quote">SAMBA</span>” among the <span class="guilabel">Download Printer Drivers for ESP 1553Print Pro 4.x</span> area and download the package. Once installed, you can prepare any driver by simply 1554highlighting the printer in the Printer Manager GUI and selecting <span class="guilabel">Export Driver...</span> from 1555the menu. Of course, you need to have prepared Samba beforehand to handle the driver files; that is, set up 1556the <em class="parameter"><code>[print$]</code></em> share, and so on. The ESP Print Pro package includes the CUPS driver 1557files as well as a (licensed) set of Adobe drivers for the Windows 95/98/Me client family. 1558</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id401275"></a>Caveats to Be Considered</h3></div></div></div><p> 1559<a class="indexterm" name="id401283"></a> 1560<a class="indexterm" name="id401290"></a> 1561<a class="indexterm" name="id401297"></a> 1562<a class="indexterm" name="id401304"></a> 1563Once you have run the install script (and possibly manually moved the <code class="filename">cups.hlp</code> file to 1564<code class="filename">/usr/share/cups/drivers/</code>), the driver is ready to be put into Samba's <em class="parameter"><code>[print$]</code></em> share (which often maps to <code class="filename">/etc/samba/drivers/</code> and contains a 1565subdirectory tree with <span class="emphasis"><em>WIN40</em></span> and <span class="emphasis"><em>W32X86</em></span> branches). You do this by 1566running <code class="literal">cupsaddsmb</code> (see also <code class="literal">man cupsaddsmb</code> for CUPS since release 15671.1.16). 1568</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p> 1569<a class="indexterm" name="id401360"></a> 1570<a class="indexterm" name="id401366"></a> 1571You may need to put root into the smbpasswd file by running <code class="literal">smbpasswd</code>; this is especially 1572important if you should run this whole procedure for the first time and are not working in an environment 1573where everything is configured for <span class="emphasis"><em>single sign-on</em></span> to a Windows Domain Controller. 1574</p></div><p> 1575Once the driver files are in the <em class="parameter"><code>[print$]</code></em> share and are initialized, they are ready 1576to be downloaded and installed by the Windows NT/200x/XP clients. 1577</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 1578Win 9x/Me clients will not work with the CUPS PostScript driver. For these you still need to use the 1579<code class="filename">ADOBE*.*</code> drivers, as previously stated. 1580</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 1581It is not harmful if you still have the <code class="filename">ADOBE*.*</code> driver files from previous installations 1582in the <code class="filename">/usr/share/cups/drivers/</code> directory. The new <code class="literal">cupsaddsmb</code> (from 15831.1.16) will automatically prefer its own drivers if it finds both. 1584</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 1585<a class="indexterm" name="id401436"></a> 1586<a class="indexterm" name="id401443"></a> 1587Should your Windows clients have had the old <code class="filename">ADOBE*.*</code> files for the Adobe PostScript 1588driver installed, the download and installation of the new CUPS PostScript driver for Windows NT/200x/XP will 1589fail at first. You need to wipe the old driver from the clients first. It is not enough to 1590“<span class="quote">delete</span>” the printer, because the driver files will still be kept by the clients and re-used if 1591you try to re-install the printer. To really get rid of the Adobe driver files on the clients, open the 1592<span class="guilabel">Printers</span> folder (possibly via <span class="guilabel">Start -> Settings -> Control Panel -> 1593Printers</span>), right-click on the folder background, and select <span class="guimenuitem">Server 1594Properties</span>. When the new dialog opens, select the <span class="guilabel">Drivers</span> tab. On the list 1595select the driver you want to delete and click the <span class="guilabel">Delete</span> button. This will only work if 1596there is not one single printer left that uses that particular driver. You need to “<span class="quote">delete</span>” all 1597printers using this driver in the <span class="guilabel">Printers</span> folder first. You will need Administrator 1598privileges to do this. 1599</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 1600<a class="indexterm" name="id401510"></a> 1601<a class="indexterm" name="id401519"></a> 1602Once you have successfully downloaded the CUPS PostScript driver to a client, you can easily switch all 1603printers to this one by proceeding as described in <a href="classicalprinting.html" title="Chapter�21.�Classical Printing Support">Classical Printing 1604Support</a>. Either change a driver for an existing printer by running the <span class="guilabel">Printer 1605Properties</span> dialog, or use <code class="literal">rpcclient</code> with the <code class="literal">setdriver</code> 1606subcommand. 1607</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id401555"></a>Windows CUPS PostScript Driver Versus Adobe Driver</h3></div></div></div><p> 1608Are you interested in a comparison between the CUPS and the Adobe PostScript drivers? For our purposes, these 1609are the most important items that weigh in favor of CUPS: 1610</p><div class="itemizedlist"><ul type="disc"><li><p>No hassle with the Adobe EULA.</p></li><li><p>No hassle with the question, “<span class="quote">Where do I 1611 get the ADOBE*.* driver files?</span>”</p></li><li><p> 1612 <a class="indexterm" name="id401583"></a> 1613 The Adobe drivers (on request of the printer PPD associated with them) often put a PJL header in front of the 1614 main PostScript part of the print file. Thus, the print file starts with <em class="parameter"><code><1B 1615 >%-12345X</code></em> or <em class="parameter"><code><escape>%-12345X</code></em> instead of 1616 <em class="parameter"><code>%!PS</code></em>. This leads to the CUPS daemon autotyping the incoming file as a print-ready file, 1617 not initiating a pass through the <em class="parameter"><code>pstops</code></em> filter (to speak more technically, it is not 1618 regarded as the generic MIME-type <a class="indexterm" name="id401617"></a> 1619 <em class="parameter"><code>application/postscript</code></em>, but as the more special MIME type 1620 <a class="indexterm" name="id401630"></a> 1621 <em class="parameter"><code>application/cups.vnd-postscript</code></em>), which therefore also leads to the page accounting in 1622 <em class="parameter"><code>/var/log/cups/page_log</code></em> not receiving the exact number of pages; instead the dummy page 1623 number of “<span class="quote">1</span>” is logged in a standard setup). 1624 </p></li><li><p>The Adobe driver has more options to misconfigure the 1625<a class="indexterm" name="id401658"></a> 1626 PostScript generated by it (like setting it inadvertently to 1627 <span class="guilabel">Optimize for Speed</span> instead of 1628 <span class="guilabel">Optimize for Portability</span>, which 1629 could lead to CUPS being unable to process it).</p></li><li><p>The CUPS PostScript driver output sent by Windows 1630<a class="indexterm" name="id401683"></a> 1631 clients to the CUPS server is guaranteed to autotype 1632 as the generic MIME type <em class="parameter"><code>application/postscript</code></em>, 1633 thus passing through the CUPS <em class="parameter"><code>pstops</code></em> filter and logging the 1634 correct number of pages in the <code class="filename">page_log</code> for 1635 accounting and quota purposes.</p></li><li><p> 1636 <a class="indexterm" name="id401713"></a> 1637 The CUPS PostScript driver supports the sending of additional standard (IPP) print options by Windows 1638 NT/200x/XP clients. Such additional print options are naming the CUPS standard <span class="emphasis"><em>banner 1639 pages</em></span> (or the custom ones, should they be installed at the time of driver download), using the CUPS 1640 page-label option, setting a job priority, and setting the scheduled time of printing (with the option to 1641 support additional useful IPP job attributes in the future). 1642 </p></li><li><p>The CUPS PostScript driver supports the inclusion of 1643 the new <em class="parameter"><code>*cupsJobTicket</code></em> comments at the 1644 beginning of the PostScript file (which could be used in the future 1645 for all sorts of beneficial extensions on the CUPS side, but which will 1646 not disturb any other applications because they will regard it as a comment 1647 and simply ignore it).</p></li><li><p>The CUPS PostScript driver will be the heart of the 1648 fully fledged CUPS IPP client for Windows NT/200x/XP to be released soon 1649 (probably alongside the first beta release for CUPS 1.2).</p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id401750"></a>Run cupsaddsmb (Quiet Mode)</h3></div></div></div><p> 1650<a class="indexterm" name="id401758"></a> 1651<a class="indexterm" name="id401765"></a> 1652The <code class="literal">cupsaddsmb</code> command copies the needed files into your <em class="parameter"><code>[print$]</code></em> 1653share. Additionally, the PPD associated with this printer is copied from <code class="filename">/etc/cups/ppd/</code> 1654to <em class="parameter"><code>[print$]</code></em>. There the files wait for convenient Windows client installations via 1655Point'n'Print. Before we can run the command successfully, we need to be sure that we can authenticate toward 1656Samba. If you have a small network, you are probably using user-level security (<a class="indexterm" name="id401798"></a>security = user). 1657</p><p> 1658Here is an example of a successfully run <code class="literal">cupsaddsmb</code> command: 1659<a class="indexterm" name="id401815"></a> 1660<a class="indexterm" name="id401822"></a> 1661</p><pre class="screen"> 1662<code class="prompt">root# </code><strong class="userinput"><code>cupsaddsmb -U root infotec_IS2027</code></strong> 1663Password for root required to access localhost via Samba: <strong class="userinput"><code>['secret']</code></strong> 1664</pre><p> 1665<a class="indexterm" name="id401853"></a> 1666To share <span class="emphasis"><em>all</em></span> printers and drivers, use the 1667<code class="option">-a</code> parameter instead of a printer name. Since 1668<code class="literal">cupsaddsmb</code> “<span class="quote">exports</span>” the printer drivers to Samba, it should be 1669obvious that it only works for queues with a CUPS driver associated. 1670</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id401880"></a>Run cupsaddsmb with Verbose Output</h3></div></div></div><p> 1671<a class="indexterm" name="id401888"></a> 1672Probably you want to see what's going on. Use the 1673<code class="option">-v</code> parameter to get a more verbose output. The 1674output below was edited for better readability: all “<span class="quote">\</span>” at the end of 1675a line indicate that I inserted an artificial line break plus some 1676indentation here: 1677<a class="indexterm" name="id401904"></a> 1678<a class="indexterm" name="id401913"></a> 1679</p><pre class="screen"> 1680<code class="prompt">root# </code><strong class="userinput"><code>cupsaddsmb -U root -v infotec_2105</code></strong> 1681Password for root required to access localhost via GANDALF: 1682Running command: smbclient //localhost/print\$ -N -U'root%secret' \ 1683 -c 'mkdir W32X86; \ 1684 put /var/spool/cups/tmp/3e98bf2d333b5 W32X86/infotec_2105.ppd; \ 1685 put /usr/share/cups/drivers/cupsdrvr.dll W32X86/cupsdrvr.dll; \ 1686 put /usr/share/cups/drivers/cupsui.dll W32X86/cupsui.dll; \ 1687 put /usr/share/cups/drivers/cups.hlp W32X86/cups.hlp' 1688added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0 1689Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a] 1690NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86 1691putting file /var/spool/cups/tmp/3e98bf2d333b5 as \W32X86/infotec_2105.ppd 1692putting file /usr/share/cups/drivers/cupsdrvr.dll as \W32X86/cupsdrvr.dll 1693putting file /usr/share/cups/drivers/cupsui.dll as \W32X86/cupsui.dll 1694putting file /usr/share/cups/drivers/cups.hlp as \W32X86/cups.hlp 1695 1696Running command: rpcclient localhost -N -U'root%secret' 1697 -c 'adddriver "Windows NT x86" \ 1698 "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \ 1699 RAW:NULL"' 1700cmd = adddriver "Windows NT x86" \ 1701 "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \ 1702 RAW:NULL" 1703Printer Driver infotec_2105 successfully installed. 1704 1705Running command: smbclient //localhost/print\$ -N -U'root%secret' \ 1706-c 'mkdir WIN40; \ 1707 put /var/spool/cups/tmp/3e98bf2d333b5 WIN40/infotec_2105.PPD; \ 1708 put /usr/share/cups/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM; \ 1709 put /usr/share/cups/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV; \ 1710 put /usr/share/cups/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP; \ 1711 put /usr/share/cups/drivers/DEFPRTR2.PPD WIN40/DEFPRTR2.PPD; \ 1712 put /usr/share/cups/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL; \ 1713 put /usr/share/cups/drivers/PSMON.DLL WIN40/PSMON.DLL;' 1714 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0 1715 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a] 1716 NT_STATUS_OBJECT_NAME_COLLISION making remote directory \WIN40 1717 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \WIN40/infotec_2105.PPD 1718 putting file /usr/share/cups/drivers/ADFONTS.MFM as \WIN40/ADFONTS.MFM 1719 putting file /usr/share/cups/drivers/ADOBEPS4.DRV as \WIN40/ADOBEPS4.DRV 1720 putting file /usr/share/cups/drivers/ADOBEPS4.HLP as \WIN40/ADOBEPS4.HLP 1721 putting file /usr/share/cups/drivers/DEFPRTR2.PPD as \WIN40/DEFPRTR2.PPD 1722 putting file /usr/share/cups/drivers/ICONLIB.DLL as \WIN40/ICONLIB.DLL 1723 putting file /usr/share/cups/drivers/PSMON.DLL as \WIN40/PSMON.DLL 1724 1725 Running command: rpcclient localhost -N -U'root%secret' \ 1726 -c 'adddriver "Windows 4.0" \ 1727 "infotec_2105:ADOBEPS4.DRV:infotec_2105.PPD:NULL:ADOBEPS4.HLP: \ 1728 PSMON.DLL:RAW:ADOBEPS4.DRV,infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL, \ 1729 ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"' 1730 cmd = adddriver "Windows 4.0" "infotec_2105:ADOBEPS4.DRV:\ 1731 infotec_2105.PPD:NULL:ADOBEPS4.HLP:PSMON.DLL:RAW:ADOBEPS4.DRV,\ 1732 infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL,ADFONTS.MFM,DEFPRTR2.PPD,\ 1733 ICONLIB.DLL" 1734 Printer Driver infotec_2105 successfully installed. 1735 1736 Running command: rpcclient localhost -N -U'root%secret' \ 1737 -c 'setdriver infotec_2105 infotec_2105' 1738 cmd = setdriver infotec_2105 infotec_2105 1739 Successfully set infotec_2105 to driver infotec_2105. 1740</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p> 1741You will see the root password for the Samba account printed on screen. 1742</p></div><p> 1743If you look closely, you'll discover your root password was transferred unencrypted over the wire, so beware! 1744Also, if you look further, you may discover error messages like NT_STATUS_OBJECT_NAME_COLLISION in the output. 1745This will occur when the directories WIN40 and W32X86 already existed in the <em class="parameter"><code>[print$]</code></em> 1746driver download share (from a previous driver installation). These are harmless warning messages. 1747</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id402011"></a>Understanding cupsaddsmb</h3></div></div></div><p> 1748<a class="indexterm" name="id402019"></a> 1749What has happened? What did <code class="literal">cupsaddsmb</code> do? There are five stages of the procedure: 1750</p><div class="orderedlist"><ol type="1"><li><p> 1751 <a class="indexterm" name="id402043"></a> 1752 Call the CUPS server via IPP and request the driver files and the PPD file for the named printer.</p></li><li><p>Store the files temporarily in the local TEMPDIR (as defined in <code class="filename">cupsd.conf</code>).</p></li><li><p>Connect via smbclient to the Samba server's <em class="parameter"><code>[print$]</code></em> share and put the files into the 1753 share's WIN40 (for Windows 9x/Me) and W32X86 (for Windows NT/200x/XP) subdirectories.</p></li><li><p> 1754 <a class="indexterm" name="id402077"></a> 1755 Connect via rpcclient to the Samba server and execute the <code class="literal">adddriver</code> command with the correct parameters. 1756 </p></li><li><p> 1757 <a class="indexterm" name="id402098"></a> 1758 Connect via rpcclient to the Samba server a second time and execute the <code class="literal">setdriver</code> command.</p></li></ol></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 1759You can run the <code class="literal">cupsaddsmb</code> utility with parameters to specify one remote host as Samba host 1760and a second remote host as CUPS host. Especially if you want to get a deeper understanding, it is a good idea 1761to try it and see more clearly what is going on (though in real life most people will have their CUPS and 1762Samba servers run on the same host): 1763</p><pre class="screen"> 1764<code class="prompt">root# </code><strong class="userinput"><code>cupsaddsmb -H sambaserver -h cupsserver -v printer</code></strong> 1765</pre><p> 1766</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id402147"></a>How to Recognize If cupsaddsmb Completed Successfully</h3></div></div></div><p> 1767You <span class="emphasis"><em>must</em></span> always check if the utility completed 1768successfully in all fields. You need at minimum these three messages 1769among the output: 1770</p><div class="orderedlist"><ol type="1"><li><p><span class="emphasis"><em>Printer Driver infotec_2105 successfully 1771 installed.</em></span> # (for the W32X86 == Windows NT/200x/XP 1772 architecture).</p></li><li><p><span class="emphasis"><em>Printer Driver infotec_2105 successfully 1773 installed.</em></span> # (for the WIN40 == Windows 9x/Me 1774 architecture).</p></li><li><p><span class="emphasis"><em>Successfully set [printerXPZ] to driver 1775 [printerXYZ].</em></span></p></li></ol></div><p> 1776These messages are probably not easily recognized in the general 1777output. If you run <code class="literal">cupsaddsmb</code> with the <code class="option">-a</code> 1778parameter (which tries to prepare <span class="emphasis"><em>all</em></span> active CUPS 1779printer drivers for download), you might miss if individual printer 1780drivers had problems installing properly. A redirection of the 1781output will help you analyze the results in retrospective. 1782</p><p> 1783If you get: 1784</p><pre class="screen"> 1785SetPrinter call failed! 1786result was WERR_ACCESS_DENIED 1787</pre><p> 1788it means that you might have set <a class="indexterm" name="id402217"></a>use client driver = yes for this printer. 1789Setting it to “<span class="quote">no</span>” will solve the problem. Refer to the <code class="filename">smb.conf</code> man page for explanation of 1790the <em class="parameter"><code>use client driver</code></em>. 1791</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 1792It is impossible to see any diagnostic output if you do not run <code class="literal">cupsaddsmb</code> in verbose mode. 1793Therefore, we strongly recommend against use of the default quiet mode. It will hide any problems from you that 1794might occur. 1795</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id402254"></a>cupsaddsmb with a Samba PDC</h3></div></div></div><p> 1796<a class="indexterm" name="id402262"></a> 1797<a class="indexterm" name="id402269"></a> 1798Can't get the standard <code class="literal">cupsaddsmb</code> command to run on a Samba PDC? Are you asked for the 1799password credential again and again, and the command just will not take off at all? Try one of these 1800variations: 1801</p><pre class="screen"> 1802<code class="prompt">root# </code><strong class="userinput"><code>cupsaddsmb -U MIDEARTH\\root -v printername</code></strong> 1803<code class="prompt">root# </code><strong class="userinput"><code>cupsaddsmb -H SAURON -U MIDEARTH\\root -v printername</code></strong> 1804<code class="prompt">root# </code><strong class="userinput"><code>cupsaddsmb -H SAURON -U MIDEARTH\\root -h cups-server -v printername</code></strong> 1805</pre><p> 1806(Note the two backslashes: the first one is required to “<span class="quote">escape</span>” the second one). 1807</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id402332"></a>cupsaddsmb Flowchart</h3></div></div></div><p> 1808<a class="indexterm" name="id402339"></a> 1809<a class="indexterm" name="id402346"></a> 1810<a href="CUPS-printing.html#small14" title="Figure�22.16.�cupsaddsmb Flowchart.">The cupsaddsmb Flowchart</a> shows a chart about the procedures, command flows, and 1811data flows of the <code class="literal">cupaddsmb</code> command. Note again: cupsaddsmb is 1812not intended to, and does not work with, raw print queues! 1813</p><div class="figure"><a name="small14"></a><p class="title"><b>Figure�22.16.�cupsaddsmb Flowchart.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/14small.png" alt="cupsaddsmb Flowchart."></div></div></div><br class="figure-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id402410"></a>Installing the PostScript Driver on a Client</h3></div></div></div><p> 1814<a class="indexterm" name="id402418"></a> 1815<a class="indexterm" name="id402425"></a> 1816After <code class="literal">cupsaddsmb</code> is completed, your driver is prepared for the clients to use. Here are the 1817steps you must perform to download and install it via Point'n'Print. From a Windows client, browse to the 1818CUPS/Samba server: 1819</p><div class="itemizedlist"><ul type="disc"><li><p> 1820 <a class="indexterm" name="id402446"></a> 1821 Open the <span class="guilabel">Printers</span> share of Samba in Network Neighborhood.</p></li><li><p>Right-click on the printer in question.</p></li><li><p>From the opening context menu select 1822 <span class="guimenuitem">Install...</span> or 1823 <span class="guimenuitem">Connect...</span> (depending on the Windows version you use).</p></li></ul></div><p> 1824After a few seconds, there should be a new printer in your client's <span class="emphasis"><em>local</em></span> 1825<span class="guilabel">Printers</span> folder. On Windows XP it will follow a naming convention of 1826<span class="emphasis"><em>PrinterName on SambaServer</em></span>. (In my current case it is infotec_2105 on kde-bitshop). If 1827you want to test it and send your first job from an application like Winword, the new printer appears in a 1828<code class="filename">\\SambaServer\PrinterName</code> entry in the drop-down list of available printers. 1829</p><p> 1830<a class="indexterm" name="id402510"></a> 1831<a class="indexterm" name="id402517"></a> 1832<a class="indexterm" name="id402524"></a> 1833<code class="literal">cupsaddsmb</code> will only reliably work with CUPS version 1.1.15 or higher and with Samba 1834version 2.2.4, or later. If it does not work, or if the automatic printer driver download to the clients does 1835not succeed, you can still manually install the CUPS printer PPD on top of the Adobe PostScript driver on 1836clients. Then point the client's printer queue to the Samba printer share for a UNC type of connection: 1837</p><pre class="screen"> 1838<code class="prompt">C:\> </code><strong class="userinput"><code>net use lpt1: \\sambaserver\printershare /user:ntadmin</code></strong> 1839</pre><p> 1840should you desire to use the CUPS networked PostScript RIP functions. (Note that user “<span class="quote">ntadmin</span>” 1841needs to be a valid Samba user with the required privileges to access the printershare.) This sets up the 1842printer connection in the traditional LanMan way (not using MS-RPC). 1843</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="cups-avoidps1"></a>Avoiding Critical PostScript Driver Settings on the Client</h3></div></div></div><p> 1844Printing works, but there are still problems. Most jobs print well, some do not print at all. Some jobs have 1845problems with fonts, which do not look very good. Some jobs print fast and some are dead-slow. Many of these 1846problems can be greatly reduced or even completely eliminated if you follow a few guidelines. Remember, if 1847your print device is not PostScript-enabled, you are treating your Ghostscript installation on your CUPS host 1848with the output your client driver settings produce. Treat it well: 1849</p><div class="itemizedlist"><ul type="disc"><li><p> 1850 Avoid the PostScript Output Option: Optimize for Speed setting. Use the Optimize for Portability instead 1851 (Adobe PostScript driver).</p></li><li><p> 1852 Don't use the Page Independence: NO setting. Instead, use Page Independence: YES (CUPS PostScript Driver). 1853 </p></li><li><p> 1854 Recommended is the True Type Font Downloading Option: Native True Type over Automatic and Outline; 1855 you should by all means avoid Bitmap (Adobe PostScript Driver).</p></li><li><p> 1856 Choose True Type Font: Download as Softfont into Printer over the default Replace by Device 1857 Font (for exotic fonts, you may need to change it back to get a printout at all; Adobe).</p></li><li><p> 1858 Sometimes you can choose PostScript Language Level: in case of problems try 2 1859 instead of 3 (the latest ESP Ghostscript package handles Level 3 PostScript very well; Adobe). 1860 </p></li><li><p> 1861 Say Yes to PostScript Error Handler (Adobe).</p></li></ul></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id402619"></a>Installing PostScript Driver Files Manually Using rpcclient</h2></div></div></div><p> 1862Of course, you can run all the commands that are embedded into the 1863cupsaddsmb convenience utility yourself, one by one, and upload 1864and prepare the driver files for future client downloads. 1865</p><div class="orderedlist"><ol type="1"><li><p>Prepare Samba (a CUPS print queue with the name of the 1866 printer should be there. We are providing the driver now).</p></li><li><p>Copy all files to <em class="parameter"><code>[print$]</code></em>.</p></li><li><p> 1867 <a class="indexterm" name="id402655"></a> 1868 Run <code class="literal">rpcclient adddriver</code> 1869 (for each client architecture you want to support).</p></li><li><p> 1870 <a class="indexterm" name="id402675"></a> 1871 Run <code class="literal">rpcclient setdriver.</code></p></li></ol></div><p> 1872<a class="indexterm" name="id402694"></a> 1873<a class="indexterm" name="id402703"></a> 1874<a class="indexterm" name="id402712"></a> 1875<a class="indexterm" name="id402721"></a> 1876<a class="indexterm" name="id402730"></a> 1877We are going to do this now. First, read the man page on <em class="parameter"><code>rpcclient</code></em> to get a first idea. 1878Look at all the printing-related subcommands: <code class="literal">enumprinters</code>, <code class="literal">enumdrivers</code>, 1879<code class="literal">enumports</code>, <code class="literal">adddriver</code>, and <code class="literal">setdriver</code> are among the 1880most interesting ones. <em class="parameter"><code>rpcclient</code></em> implements an important part of the MS-RPC protocol. 1881You can use it to query (and command) a Windows NT (or 200x/XP) PC, too. MS-RPC is used by Windows clients, 1882among other things, to benefit from the Point'n'Print features. Samba can now mimic this as well. 1883</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id402785"></a>A Check of the rpcclient man Page</h3></div></div></div><p> 1884First let's check the <em class="parameter"><code>rpcclient</code></em> man page. Here are two relevant passages: 1885</p><p> 1886<a class="indexterm" name="id402803"></a> 1887<a class="indexterm" name="id402810"></a> 1888<a class="indexterm" name="id402816"></a> 1889<code class="literal">adddriver <arch> <config></code> Execute an <code class="literal">AddPrinterDriver()</code> RPC 1890to install the printer driver information on the server. The driver files should already exist in the 1891directory returned by <code class="literal">getdriverdir</code>. Possible values for <em class="parameter"><code>arch</code></em> are the 1892same as those for the <code class="literal">getdriverdir</code> command. The <em class="parameter"><code>config</code></em> parameter is 1893defined as follows: 1894</p><pre class="screen"> 1895Long Printer Name:\ 1896Driver File Name:\ 1897Data File Name:\ 1898Config File Name:\ 1899Help File Name:\ 1900Language Monitor Name:\ 1901Default Data Type:\ 1902Comma Separated list of Files 1903</pre><p> 1904Any empty fields should be entered as the string “<span class="quote">NULL</span>”. 1905</p><p> 1906Samba does not need to support the concept of print monitors, since these only apply to local printers whose 1907drivers can use a bidirectional link for communication. This field should be “<span class="quote">NULL</span>”. On a remote 1908NT print server, the print monitor for a driver must already be installed before adding the driver or else the 1909RPC will fail. 1910</p><p> 1911<a class="indexterm" name="id402887"></a> 1912<a class="indexterm" name="id402894"></a> 1913<code class="literal">setdriver <printername> <drivername></code> Execute a <code class="literal">SetPrinter()</code> 1914command to update the printer driver associated with an installed printer. The printer driver must already be 1915correctly installed on the print server. 1916</p><p> 1917<a class="indexterm" name="id402917"></a> 1918<a class="indexterm" name="id402924"></a> 1919See also the <code class="literal">enumprinters</code> and <code class="literal">enumdrivers</code> commands to 1920obtain a list of installed printers and drivers. 1921</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id402945"></a>Understanding the rpcclient man Page</h3></div></div></div><p> 1922<a class="indexterm" name="id402953"></a> 1923The <span class="emphasis"><em>exact</em></span> format isn't made too clear by the man page, since you have to deal with some 1924parameters containing spaces. Here is a better description for it. We have line-broken the command and 1925indicated the breaks with “<span class="quote">\</span>”. Usually you would type the command in one line without the line 1926breaks: 1927</p><pre class="screen"> 1928adddriver "Architecture" \ 1929 "LongPrinterName:DriverFile:DataFile:ConfigFile:HelpFile:\ 1930 LanguageMonitorFile:DataType:ListOfFiles,Comma-separated" 1931</pre><p> 1932What the man pages denote as a simple <em class="parameter"><code><config></code></em> keyword in reality consists of 1933eight colon-separated fields. The last field may take multiple (in some very insane cases, even 20 different 1934additional) files. This might sound confusing at first. What the man pages call the 1935“<span class="quote">LongPrinterName</span>” in reality should be called the “<span class="quote">Driver Name</span>”. You can name it 1936anything you want, as long as you use this name later in the <code class="literal">rpcclient ... setdriver</code> 1937command. For practical reasons, many name the driver the same as the printer. 1938</p><p> 1939It isn't simple at all. I hear you asking: “<span class="quote">How do I know which files are Driver File</span>”, 1940“<span class="quote">Data File</span>”, “<span class="quote">Config File</span>”, “<span class="quote">Help File</span>” and “<span class="quote">Language Monitor 1941File in each case?</span>” For an answer, you may want to have a look at how a Windows NT box with a shared 1942printer presents the files to us. Remember that this whole procedure has to be developed by the Samba Team by 1943listening to the traffic caused by Windows computers on the wire. We may as well turn to a Windows box now and 1944access it from a UNIX workstation. We will query it with <code class="literal">rpcclient</code> to see what it tells us 1945and try to understand the man page more clearly. 1946</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id403037"></a>Producing an Example by Querying a Windows Box</h3></div></div></div><p> 1947<a class="indexterm" name="id403045"></a> 1948<a class="indexterm" name="id403055"></a> 1949We could run <code class="literal">rpcclient</code> with a <code class="literal">getdriver</code> or a 1950<code class="literal">getprinter</code> subcommand (in level 3 verbosity) against it. Just sit down at a UNIX or Linux 1951workstation with the Samba utilities installed, then type the following command: 1952</p><pre class="screen"> 1953<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -U'user%secret' NT-SERVER -c 'getdriver printername 3'</code></strong> 1954</pre><p> 1955From the result it should become clear which is which. Here is an example from my installation: 1956<a class="indexterm" name="id403103"></a> 1957</p><pre class="screen"> 1958<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -U'Danka%xxxx' W200xSERVER \ 1959 -c'getdriver "DANKA InfoStream Virtual Printer" 3'</code></strong> 1960 cmd = getdriver "DANKA InfoStream Virtual Printer" 3 1961 1962 [Windows NT x86] 1963 Printer Driver Info 3: 1964 Version: [2] 1965 Driver Name: [DANKA InfoStream] 1966 Architecture: [Windows NT x86] 1967 Driver Path: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRIPT.DLL] 1968 Datafile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\INFOSTRM.PPD] 1969 Configfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRPTUI.DLL] 1970 Helpfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\PSCRIPT.HLP] 1971 1972 Dependentfiles: [] 1973 Dependentfiles: [] 1974 Dependentfiles: [] 1975 Dependentfiles: [] 1976 Dependentfiles: [] 1977 Dependentfiles: [] 1978 Dependentfiles: [] 1979 1980 Monitorname: [] 1981 Defaultdatatype: [] 1982</pre><p> 1983Some printer drivers list additional files under the label <em class="parameter"><code>Dependentfiles</code></em>, and these 1984would go into the last field <em class="parameter"><code>ListOfFiles,Comma-separated</code></em>. For the CUPS PostScript 1985drivers, we do not need any (nor would we for the Adobe PostScript driver); therefore, the field will get a 1986“<span class="quote">NULL</span>” entry. 1987</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id403163"></a>Requirements for adddriver and setdriver to Succeed</h3></div></div></div><p> 1988<a class="indexterm" name="id403171"></a> 1989<a class="indexterm" name="id403180"></a> 1990<a class="indexterm" name="id403187"></a> 1991From the man page (and from the quoted output of <code class="literal">cupsaddsmb</code> above) it becomes clear that 1992you need to have certain conditions in order to make the manual uploading and initializing of the driver files 1993succeed. The two <code class="literal">rpcclient</code> subcommands (<code class="literal">adddriver</code> and 1994<code class="literal">setdriver</code>) need to encounter the following preconditions to complete successfully: 1995</p><div class="itemizedlist"><ul type="disc"><li><p>You are connected as <a class="indexterm" name="id403227"></a>printer admin or root (this is 1996 <span class="emphasis"><em>not</em></span> the “<span class="quote">Printer Operators</span>” group in NT, but the <span class="emphasis"><em>printer 1997 admin</em></span> group as defined in the <em class="parameter"><code>[global]</code></em> section of <code class="filename">smb.conf</code>). 1998 </p></li><li><p>Copy all required driver files to <code class="filename">\\SAMBA\print$\w32x86</code> and 1999 <code class="filename">\\SAMBA\print$\win40</code> as appropriate. They will end up in the “<span class="quote">0</span>” respective 2000 “<span class="quote">2</span>” subdirectories later. For now, <span class="emphasis"><em>do not</em></span> put them there; they'll be 2001 automatically used by the <code class="literal">adddriver</code> subcommand. (If you use <code class="literal">smbclient</code> to 2002 put the driver files into the share, note that you need to escape the “<span class="quote">$</span>”: <code class="literal">smbclient 2003 //sambaserver/print\$ -U root.</code>)</p></li><li><p>The user you're connecting as must be able to write to 2004 the <em class="parameter"><code>[print$]</code></em> share and create 2005 subdirectories.</p></li><li><p>The printer you are going to set up for the Windows 2006 clients needs to be installed in CUPS already.</p></li><li><p> 2007 <a class="indexterm" name="id403328"></a> 2008 <a class="indexterm" name="id403337"></a> 2009 The CUPS printer must be known to Samba; otherwise the <code class="literal">setdriver</code> subcommand fails with an 2010 NT_STATUS_UNSUCCESSFUL error. To check if the printer is known by Samba, you may use the 2011 <code class="literal">enumprinters</code> subcommand to <code class="literal">rpcclient</code>. A long-standing bug prevented a 2012 proper update of the printer list until every smbd process had received a SIGHUP or was restarted. Remember 2013 this in case you've created the CUPS printer just recently and encounter problems: try restarting Samba. 2014 </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id403371"></a>Manual Driver Installation in 15 Steps</h3></div></div></div><p> 2015We are going to install a printer driver now by manually executing all 2016required commands. Because this may seem a rather complicated process at 2017first, we go through the procedure step by step, explaining every 2018single action item as it comes up. 2019</p><div class="procedure"><a name="id403382"></a><p class="title"><b>Procedure�22.2.�Manual Driver Installation</b></p><ol type="1"><li><p class="title"><b>Install the printer on CUPS.</b></p><pre class="screen"> 2020 <code class="prompt">root# </code><strong class="userinput"><code>lpadmin -p mysmbtstprn -v socket://10.160.51.131:9100 -E \ 2021 -P canonIR85.ppd</code></strong> 2022 </pre><p> 2023 This installs a printer with the name <em class="parameter"><code>mysmbtstprn</code></em> 2024 to the CUPS system. The printer is accessed via a socket 2025 (a.k.a. JetDirect or Direct TCP/IP) connection. You need to be root 2026 for this step. 2027 </p></li><li><p class="title"><b>(Optional.) Check if the printer is recognized by Samba.</b></p><p> 2028 <a class="indexterm" name="id403435"></a> 2029</p><pre class="screen"> 2030<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx -c 'enumprinters' localhost \ 2031 | grep -C2 mysmbtstprn</code></strong> 2032flags:[0x800000] 2033name:[\\kde-bitshop\mysmbtstprn] 2034description:[\\kde-bitshop\mysmbtstprn,,mysmbtstprn] 2035comment:[mysmbtstprn] 2036</pre><p> 2037 </p><p> 2038 This should show the printer in the list. If not, stop and restart the Samba daemon (smbd) or send a HUP signal: 2039</p><pre class="screen"> 2040<code class="prompt">root# </code><strong class="userinput"><code>kill -HUP `pidof smbd`</code></strong> 2041</pre><p> 2042 Check again. Troubleshoot and repeat until successful. Note the “<span class="quote">empty</span>” field between the two 2043 commas in the “<span class="quote">description</span>” line. The driver name would appear here if there was one already. You 2044 need to know root's Samba password (as set by the <code class="literal">smbpasswd</code> command) for this step and most 2045 of the following steps. Alternatively, you can authenticate as one of the users from the “<span class="quote">write 2046 list</span>” as defined in <code class="filename">smb.conf</code> for <em class="parameter"><code>[print$]</code></em>. 2047 </p></li><li><p class="title"><b>(Optional.) Check if Samba knows a driver for the printer.</b></p><p> 2048 <a class="indexterm" name="id403526"></a> 2049 <a class="indexterm" name="id403536"></a> 2050</p><pre class="screen"> 2051<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2'\ 2052 localhost | grep driver </code></strong> 2053 2054drivername:[] 2055 2056<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' \ 2057 localhost | grep -C4 driv</code></strong> 2058 2059servername:[\\kde-bitshop] 2060printername:[\\kde-bitshop\mysmbtstprn] 2061sharename:[mysmbtstprn] 2062portname:[Samba Printer Port] 2063drivername:[] 2064comment:[mysmbtstprn] 2065location:[] 2066sepfile:[] 2067printprocessor:[winprint] 2068 2069<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -U root%xxxx -c 'getdriver mysmbtstprn' localhost</code></strong> 2070 result was WERR_UNKNOWN_PRINTER_DRIVER 2071</pre><p> 2072None of the three commands shown above should show a driver. 2073This step was done for the purpose of demonstrating this condition. An 2074attempt to connect to the printer at this stage will prompt a 2075message along the lines of, “<span class="quote">The server does not have the required printer 2076driver installed.</span>” 2077</p></li><li><p class="title"><b>Put all required driver files into Samba's 2078[print$].</b></p><pre class="screen"> 2079<code class="prompt">root# </code><strong class="userinput"><code>smbclient //localhost/print\$ -U 'root%xxxx' \ 2080 -c 'cd W32X86; \ 2081 put /etc/cups/ppd/mysmbtstprn.ppd mysmbtstprn.PPD; \ 2082 put /usr/share/cups/drivers/cupsui.dll cupsui.dll; \ 2083 put /usr/share/cups/drivers/cupsdrvr.dll cupsdrvr.dll; \ 2084 put /usr/share/cups/drivers/cups.hlp cups.hlp'</code></strong> 2085</pre><p> 2086(This command should be entered in one long single line. Line breaks and the line ends indicated by 2087“<span class="quote">\</span>” have been inserted for readability reasons.) This step is <span class="emphasis"><em>required</em></span> for 2088the next one to succeed. It makes the driver files physically present in the <em class="parameter"><code>[print$]</code></em> 2089share. However, clients would still not be able to install them, because Samba does not yet treat them as 2090driver files. A client asking for the driver would still be presented with a “<span class="quote">not installed here</span>” 2091message. 2092</p></li><li><p class="title"><b>Verify where the driver files are now.</b></p><pre class="screen"> 2093<code class="prompt">root# </code><strong class="userinput"><code>ls -l /etc/samba/drivers/W32X86/</code></strong> 2094total 669 2095drwxr-sr-x 2 root ntadmin 532 May 25 23:08 2 2096drwxr-sr-x 2 root ntadmin 670 May 16 03:15 3 2097-rwxr--r-- 1 root ntadmin 14234 May 25 23:21 cups.hlp 2098-rwxr--r-- 1 root ntadmin 278380 May 25 23:21 cupsdrvr.dll 2099-rwxr--r-- 1 root ntadmin 215848 May 25 23:21 cupsui.dll 2100-rwxr--r-- 1 root ntadmin 169458 May 25 23:21 mysmbtstprn.PPD 2101</pre><p> 2102The driver files now are in the W32X86 architecture “<span class="quote">root</span>” of 2103<em class="parameter"><code>[print$]</code></em>. 2104</p></li><li><p class="title"><b>Tell Samba that these are driver files (<code class="literal">adddriver</code>).</b></p><p> 2105<a class="indexterm" name="id403706"></a> 2106</p><pre class="screen"> 2107<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" \ 2108 "mydrivername:cupsdrvr.dll:mysmbtstprn.PPD: \ 2109 cupsui.dll:cups.hlp:NULL:RAW:NULL"' \ 2110 localhost</code></strong> 2111Printer Driver mydrivername successfully installed. 2112</pre><p> 2113You cannot repeat this step if it fails. It could fail even as a result of a simple typo. It will most likely 2114have moved a part of the driver files into the “<span class="quote">2</span>” subdirectory. If this step fails, you need to 2115go back to the fourth step and repeat it before you can try this one again. In this step, you need to choose a 2116name for your driver. It is normally a good idea to use the same name as is used for the printer name; 2117however, in big installations you may use this driver for a number of printers that obviously have different 2118names, so the name of the driver is not fixed. 2119</p></li><li><p class="title"><b>Verify where the driver files are now.</b></p><pre class="screen"> 2120<code class="prompt">root# </code><strong class="userinput"><code>ls -l /etc/samba/drivers/W32X86/</code></strong> 2121total 1 2122drwxr-sr-x 2 root ntadmin 532 May 25 23:22 2 2123drwxr-sr-x 2 root ntadmin 670 May 16 03:15 3 2124 2125<code class="prompt">root# </code><strong class="userinput"><code>ls -l /etc/samba/drivers/W32X86/2</code></strong> 2126total 5039 2127[....] 2128-rwxr--r-- 1 root ntadmin 14234 May 25 23:21 cups.hlp 2129-rwxr--r-- 1 root ntadmin 278380 May 13 13:53 cupsdrvr.dll 2130-rwxr--r-- 1 root ntadmin 215848 May 13 13:53 cupsui.dll 2131-rwxr--r-- 1 root ntadmin 169458 May 25 23:21 mysmbtstprn.PPD 2132</pre><p> 2133Notice how step 6 also moved the driver files to the appropriate 2134subdirectory. Compare this with the situation after step 5. 2135</p></li><li><p class="title"><b>(Optional.) Verify if Samba now recognizes the driver.</b></p><p> 2136<a class="indexterm" name="id403801"></a> 2137</p><pre class="screen"> 2138<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx -c 'enumdrivers 3' \ 2139 localhost | grep -B2 -A5 mydrivername</code></strong> 2140Printer Driver Info 3: 2141Version: [2] 2142Driver Name: [mydrivername] 2143Architecture: [Windows NT x86] 2144Driver Path: [\\kde-bitshop\print$\W32X86\2\cupsdrvr.dll] 2145Datafile: [\\kde-bitshop\print$\W32X86\2\mysmbtstprn.PPD] 2146Configfile: [\\kde-bitshop\print$\W32X86\2\cupsui.dll] 2147Helpfile: [\\kde-bitshop\print$\W32X86\2\cups.hlp] 2148</pre><p> 2149Remember, this command greps for the name you chose for the 2150driver in step 6. This command must succeed before you can proceed. 2151</p></li><li><p><font color="red"><title>Tell Samba which printer should use these driver files (<code class="literal">setdriver</code>).</title></font></p><p> 2152<a class="indexterm" name="id403852"></a> 2153</p><pre class="screen"> 2154<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx -c 'setdriver mysmbtstprn mydrivername' \ 2155 localhost</code></strong> 2156Successfully set mysmbtstprn to driver mydrivername 2157</pre><p> 2158Since you can bind any printer name (print queue) to any driver, this is a convenient way to set up many 2159queues that use the same driver. You do not need to repeat all the previous steps for the setdriver command to 2160succeed. The only preconditions are that <code class="literal">enumdrivers</code> must find the driver and 2161<code class="literal">enumprinters</code> must find the printer. 2162</p></li><li><p class="title"><b>(Optional) Verify if Samba has recognized this association.</b></p><p> 2163<a class="indexterm" name="id403907"></a> 2164<a class="indexterm" name="id403916"></a> 2165<a class="indexterm" name="id403926"></a> 2166</p><pre class="screen"> 2167<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \ 2168 | grep driver</code></strong> 2169drivername:[mydrivername] 2170 2171<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \ 2172 | grep -C4 driv</code></strong> 2173servername:[\\kde-bitshop] 2174printername:[\\kde-bitshop\mysmbtstprn] 2175sharename:[mysmbtstprn] 2176portname:[Done] 2177drivername:[mydrivername] 2178comment:[mysmbtstprn] 2179location:[] 2180sepfile:[] 2181printprocessor:[winprint] 2182 2183<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -U root%xxxx -c 'getdriver mysmbtstprn' localhost</code></strong> 2184[Windows NT x86] 2185Printer Driver Info 3: 2186 Version: [2] 2187 Driver Name: [mydrivername] 2188 Architecture: [Windows NT x86] 2189 Driver Path: [\\kde-bitshop\print$\W32X86\2\cupsdrvr.dll] 2190 Datafile: [\\kde-bitshop\print$\W32X86\2\mysmbtstprn.PPD] 2191 Configfile: [\\kde-bitshop\print$\W32X86\2\cupsui.dll] 2192 Helpfile: [\\kde-bitshop\print$\W32X86\2\cups.hlp] 2193 Monitorname: [] 2194 Defaultdatatype: [RAW] 2195 Monitorname: [] 2196 Defaultdatatype: [RAW] 2197 2198<code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx -c 'enumprinters' localhost \ 2199 | grep mysmbtstprn</code></strong> 2200 name:[\\kde-bitshop\mysmbtstprn] 2201 description:[\\kde-bitshop\mysmbtstprn,mydrivername,mysmbtstprn] 2202 comment:[mysmbtstprn] 2203 2204</pre><p> 2205<a class="indexterm" name="id403993"></a> 2206Compare these results with the ones from steps 2 and 3. Every one of these commands show the driver is installed. Even 2207the <code class="literal">enumprinters</code> command now lists the driver 2208on the “<span class="quote">description</span>” line. 2209</p></li><li><p class="title"><b>(Optional.) Tickle the driver into a correct 2210device mode.</b></p><p> 2211<a class="indexterm" name="id404026"></a> 2212You certainly know how to install the driver on the client. In case 2213you are not particularly familiar with Windows, here is a short 2214recipe: Browse the Network Neighborhood, go to the Samba server, and look 2215for the shares. You should see all shared Samba printers. 2216Double-click on the one in question. The driver should get 2217installed and the network connection set up. Another way is to 2218open the <span class="guilabel">Printers (and Faxes)</span> folder, right-click on the printer in 2219question, and select <span class="guilabel">Connect</span> or <span class="guilabel">Install</span>. As a result, a new printer 2220should appear in your client's local <span class="guilabel">Printers (and Faxes)</span> 2221folder, named something like <span class="guilabel">printersharename on Sambahostname</span>. 2222</p><p> 2223It is important that you execute this step as a Samba printer admin 2224(as defined in <code class="filename">smb.conf</code>). Here is another method 2225to do this on Windows XP. It uses a command line, which you may type 2226into the “<span class="quote">DOS box</span>” (type root's smbpassword when prompted): 2227</p><pre class="screen"> 2228<code class="prompt">C:\> </code><strong class="userinput"><code>runas /netonly /user:root "rundll32 printui.dll,PrintUIEntry \ 2229 /in /n \\sambaserver\mysmbtstprn"</code></strong> 2230</pre><p> 2231Change any printer setting once (like changing <span class="emphasis"><em><span class="guilabel">portrait</span> to 2232<span class="guilabel">landscape</span></em></span>), click on <span class="guibutton">Apply</span>, and change the setting back. 2233</p></li><li><p class="title"><b>Install the printer on a client (Point'n'Print).</b></p><p> 2234<a class="indexterm" name="id404135"></a> 2235</p><pre class="screen"> 2236<code class="prompt">C:\> </code><strong class="userinput"><code>rundll32 printui.dll,PrintUIEntry /in /n "\\sambaserver\mysmbtstprn"</code></strong> 2237</pre><p> 2238If it does not work, it could be a permissions problem with the <em class="parameter"><code>[print$]</code></em> share. 2239</p></li><li><p class="title"><b>(Optional) Print a test page.</b></p><a class="indexterm" name="id404175"></a><pre class="screen"> 2240<code class="prompt">C:\> </code><strong class="userinput"><code>rundll32 printui.dll,PrintUIEntry /p /n "\\sambaserver\mysmbtstprn"</code></strong> 2241</pre><p> 2242Then hit [TAB] five times, [ENTER] twice, [TAB] once, and [ENTER] again, and march to the printer. 2243</p></li><li><p class="title"><b>(Recommended.) Study the test page.</b></p><p> 2244Hmmm. Just kidding! By now you know everything about printer installations and you do not need to read a word. 2245Just put it in a frame and bolt it to the wall with the heading "MY FIRST RPCCLIENT-INSTALLED PRINTER" 2246 why not just throw it away! 2247</p></li><li><p class="title"><b>(Obligatory.) Enjoy. Jump. Celebrate your success.</b></p><pre class="screen"> 2248<code class="prompt">root# </code><strong class="userinput"><code>echo "Cheeeeerioooooo! Success..." >> /var/log/samba/log.smbd</code></strong> 2249</pre></li></ol></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id404250"></a>Troubleshooting Revisited</h3></div></div></div><p> 2250<a class="indexterm" name="id404258"></a> 2251The setdriver command will fail if in Samba's mind the queue is not 2252already there. A successful installation displys the promising message that the: 2253</p><pre class="screen"> 2254Printer Driver ABC successfully installed. 2255</pre><p> 2256following the <code class="literal">adddriver</code> parts of the procedure. But you may also see 2257a disappointing message like this one: 2258<code class="computeroutput"> 2259result was NT_STATUS_UNSUCCESSFUL 2260</code></p><p> 2261<a class="indexterm" name="id404287"></a> 2262<a class="indexterm" name="id404294"></a> 2263It is not good enough that you can see the queue in CUPS, using the <code class="literal">lpstat -p ir85wm</code> 2264command. A bug in most recent versions of Samba prevents the proper update of the queue list. The recognition 2265of newly installed CUPS printers fails unless you restart Samba or send a HUP to all smbd processes. To verify 2266if this is the reason why Samba does not execute the <code class="literal">setdriver</code> command successfully, check 2267if Samba “<span class="quote">sees</span>” the printer: 2268<a class="indexterm" name="id404319"></a> 2269</p><pre class="screen"> 2270<code class="prompt">root# </code><strong class="userinput"><code>rpcclient transmeta -N -U'root%xxxx' -c 'enumprinters 0'|grep ir85wm</code></strong> 2271 printername:[ir85wm] 2272</pre><p> 2273An alternate command could be this: 2274<a class="indexterm" name="id404347"></a> 2275</p><pre class="screen"> 2276<code class="prompt">root# </code><strong class="userinput"><code>rpcclient transmeta -N -U'root%secret' -c 'getprinter ir85wm' </code></strong> 2277 cmd = getprinter ir85wm 2278 flags:[0x800000] 2279 name:[\\transmeta\ir85wm] 2280 description:[\\transmeta\ir85wm,ir85wm,DPD] 2281 comment:[CUPS PostScript-Treiber for Windows NT/200x/XP] 2282</pre><p> 2283By the way, you can use these commands, plus a few more, of course, to install drivers on remote Windows NT print servers too! 2284</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id404381"></a>The Printing <code class="filename">*.tdb</code> Files</h2></div></div></div><p> 2285<a class="indexterm" name="id404395"></a> 2286<a class="indexterm" name="id404402"></a> 2287<a class="indexterm" name="id404410"></a> 2288<a class="indexterm" name="id404419"></a> 2289<a class="indexterm" name="id404428"></a> 2290<a class="indexterm" name="id404437"></a> 2291<a class="indexterm" name="id404446"></a> 2292<a class="indexterm" name="id404455"></a> 2293<a class="indexterm" name="id404464"></a> 2294<a class="indexterm" name="id404473"></a> 2295<a class="indexterm" name="id404482"></a> 2296<a class="indexterm" name="id404491"></a> 2297<a class="indexterm" name="id404500"></a> 2298Some mystery is associated with the series of files with a tdb suffix appearing in every Samba installation. 2299They are <code class="filename">connections.tdb</code>, <code class="filename">printing.tdb</code>, 2300<code class="filename">share_info.tdb</code>, <code class="filename">ntdrivers.tdb</code>, <code class="filename">unexpected.tdb</code>, 2301<code class="filename">brlock.tdb</code>, <code class="filename">locking.tdb</code>, <code class="filename">ntforms.tdb</code>, 2302<code class="filename">messages.tdb</code> , <code class="filename">ntprinters.tdb</code>, <code class="filename">sessionid.tdb</code>, 2303and <code class="filename">secrets.tdb</code>. What is their purpose? 2304</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id404580"></a>Trivial Database Files</h3></div></div></div><p> 2305<a class="indexterm" name="id404588"></a> 2306A Windows NT (print) server keeps track of all information needed to serve its duty toward its clients by 2307storing entries in the Windows registry. Client queries are answered by reading from the registry, 2308Administrator or user configuration settings that are saved by writing into the registry. Samba and UNIX 2309obviously do not have such a Registry. Samba instead keeps track of all client-related information in a series 2310of <code class="filename">*.tdb</code> files. (TDB stands for trivial data base). These are often located in 2311<code class="filename">/var/lib/samba/</code> or <code class="filename">/var/lock/samba/</code>. The printing-related files are 2312<code class="filename">ntprinters.tdb</code>, <code class="filename">printing.tdb</code>,<code class="filename">ntforms.tdb</code>, and 2313<code class="filename">ntdrivers.tdb</code>. 2314</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id404646"></a>Binary Format</h3></div></div></div><p> 2315<code class="filename">*.tdb</code> files are not human readable. They are written in a binary format. “<span class="quote">Why not 2316ASCII?</span>”, you may ask. “<span class="quote">After all, ASCII configuration files are a good and proven tradition on 2317UNIX.</span>” The reason for this design decision by the Samba Team is mainly performance. Samba needs to be 2318fast; it runs a separate <code class="literal">smbd</code> process for each client connection, in some environments many 2319thousands of them. Some of these <code class="literal">smbds</code> might need to write-access the same 2320<code class="filename">*.tdb</code> file <span class="emphasis"><em>at the same time</em></span>. The file format of Samba's 2321<code class="filename">*.tdb</code> files allows for this provision. Many smbd processes may write to the same 2322<code class="filename">*.tdb</code> file at the same time. This wouldn't be possible with pure ASCII files. 2323</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id404707"></a>Losing <code class="filename">*.tdb</code> Files</h3></div></div></div><p> 2324It is very important that all <code class="filename">*.tdb</code> files remain consistent over all write and read 2325accesses. However, it may happen that these files <span class="emphasis"><em>do</em></span> get corrupted. (A <code class="literal">kill -9 2326`pidof smbd'</code> while a write access is in progress could do the damage, as could a power interruption, 2327etc.). In cases of trouble, a deletion of the old printing-related <code class="filename">*.tdb</code> files may be the 2328only option. After that, you need to re-create all print-related setups unless you have made a backup of the 2329<code class="filename">*.tdb</code> files in time. 2330</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id404753"></a>Using <code class="literal">tdbbackup</code></h3></div></div></div><p> 2331<a class="indexterm" name="id404766"></a> 2332<a class="indexterm" name="id404777"></a> 2333Samba ships with a little utility that helps the root user of your system to backup your 2334<code class="filename">*.tdb</code> files. If you run it with no argument, it prints a usage message: 2335</p><pre class="screen"> 2336<code class="prompt">root# </code><strong class="userinput"><code>tdbbackup</code></strong> 2337 Usage: tdbbackup [options] <fname...> 2338 2339 Version:3.0a 2340 -h this help message 2341 -s suffix set the backup suffix 2342 -v verify mode (restore if corrupt) 2343</pre><p> 2344Here is how I backed up my <code class="filename">printing.tdb</code> file: 2345</p><pre class="screen"> 2346<code class="prompt">root# </code><strong class="userinput"><code>ls</code></strong> 2347. browse.dat locking.tdb ntdrivers.tdb printing.tdb 2348.. share_info.tdb connections.tdb messages.tdb ntforms.tdb 2349printing.tdbkp unexpected.tdb brlock.tdb gmon.out namelist.debug 2350ntprinters.tdb sessionid.tdb 2351 2352<code class="prompt">root# </code><strong class="userinput"><code>tdbbackup -s .bak printing.tdb</code></strong> 2353 printing.tdb : 135 records 2354 2355<code class="prompt">root# </code><strong class="userinput"><code>ls -l printing.tdb*</code></strong> 2356 -rw------- 1 root root 40960 May 2 03:44 printing.tdb 2357 -rw------- 1 root root 40960 May 2 03:44 printing.tdb.bak 2358 2359</pre></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id404864"></a>CUPS Print Drivers from Linuxprinting.org</h2></div></div></div><p> 2360<a class="indexterm" name="id404872"></a> 2361CUPS ships with good support for HP LaserJet-type printers. You can install the generic driver as follows: 2362<a class="indexterm" name="id404880"></a> 2363</p><pre class="screen"> 2364<code class="prompt">root# </code><strong class="userinput"><code>lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -m laserjet.ppd</code></strong> 2365</pre><p> 2366The <code class="option">-m</code> switch will retrieve the <code class="filename">laserjet.ppd</code> from the standard 2367repository for not-yet-installed PPDs, which CUPS typically stores in 2368<code class="filename">/usr/share/cups/model</code>. Alternatively, you may use <code class="option">-P /path/to/your.ppd</code>. 2369</p><p> 2370The generic <code class="filename">laserjet.ppd,</code> however, does not support every special option for every 2371LaserJet-compatible model. It constitutes a sort of “<span class="quote">least common denominator</span>” of all the models. 2372If for some reason you must pay for the commercially available ESP Print Pro drivers, your first move should 2373be to consult the database on the <a href="http://www.linuxprinting.org/printer_list.cgi" target="_top">Linuxprinting</a> Web site. Linuxprinting.org has 2374excellent recommendations about which driver is best used for each printer. Its database is kept current by 2375the tireless work of Till Kamppeter from Mandrakesoft, who is also the principal author of the 2376<code class="literal">foomatic-rip</code> utility. 2377</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 2378<a class="indexterm" name="id404961"></a> 2379<a class="indexterm" name="id404967"></a> 2380<a class="indexterm" name="id404974"></a> 2381The former <code class="literal">cupsomatic</code> concept is now being replaced by the new successor, a much more 2382powerful <code class="literal">foomatic-rip</code>. <code class="literal">cupsomatic</code> is no longer maintained. Here is the 2383new URL to the <a href="http://www.linuxprinting.org/driver_list.cgi" target="_top">Foomatic-3.0</a> 2384database. If you upgrade to <code class="literal">foomatic-rip</code>, remember to also upgrade to the new-style PPDs 2385for your Foomatic-driven printers. foomatic-rip will not work with PPDs generated for the old 2386<code class="literal">cupsomatic</code>. The new-style PPDs are 100% compliant with the Adobe PPD specification. They 2387are also intended to be used by Samba and the cupsaddsmb utility, to provide the driver files for the Windows 2388clients! 2389</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id405024"></a>foomatic-rip and Foomatic Explained</h3></div></div></div><p> 2390<a class="indexterm" name="id405032"></a> 2391<a class="indexterm" name="id405039"></a> 2392Nowadays, most Linux distributions rely on the utilities from the <a href="http://www.linuxprinting.org/" target="_top">Linuxprinting.org</a> to create their printing-related software 2393(which, by the way, works on all UNIXes and on Mac OS X and Darwin, too). The utilities from this sire have a 2394very end-user-friendly interface that allows for an easy update of drivers and PPDs for all supported models, 2395all spoolers, all operating systems, and all package formats (because there is none). Its history goes back a 2396few years. 2397</p><p> 2398Recently, Foomatic has achieved the astonishing milestone of <a href="http://www.linuxprinting.org/printer_list.cgi?make=Anyone" target="_top">1,000 listed</a> printer models. 2399Linuxprinting.org keeps all the important facts about printer drivers, supported models, and which options are 2400available for the various driver/printer combinations in its <a href="http://www.linuxprinting.org/foomatic.html" target="_top">Foomatic</a> database. Currently there are <a href="http://www.linuxprinting.org/driver_list.cgi" target="_top">245 drivers</a> in the database. Many drivers support 2401various models, and many models may be driven by different drivers its your choice! 2402</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id405085"></a>690 “<span class="quote">Perfect</span>” Printers</h4></div></div></div><p> 2403<a class="indexterm" name="id405096"></a> 2404At present, there are 690 devices dubbed as working perfectly: 181 are <span class="emphasis"><em>mostly</em></span> perfect, 96 2405are <span class="emphasis"><em>partially</em></span> perfect, and 46 are paperweights. Keeping in mind that most of these are 2406non-PostScript models (PostScript printers are automatically supported by CUPS to perfection by using their 2407own manufacturer-provided Windows PPD), and that a multifunctional device never qualifies as working perfectly 2408if it does not also scan and copy and fax under GNU/Linux then this is a truly astonishing 2409achievement! Three years ago the number was not more than 500, and Linux or UNIX printing at the time wasn't 2410anywhere near the quality it is today. 2411</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id405121"></a>How the Printing HOWTO Started It All</h4></div></div></div><p> 2412A few years ago <a href="http://www2.picante.com/" target="_top">Grant Taylor</a> started it all. The 2413roots of today's Linuxprinting.org are in the first <a href="http://www.linuxprinting.org/foomatic2.9/howto/" target="_top">Linux Printing HOWTO</a> that he authored. As a 2414side-project to this document, which served many Linux users and admins to guide their first steps in this 2415complicated and delicate setup (to a scientist, printing is “<span class="quote">applying a structured deposition of 2416distinct patterns of ink or toner particles on paper substrates</span>”), he started to build in a little 2417Postgres database with information about the hardware and driver zoo that made up Linux printing of the time. 2418This database became the core component of today's Foomatic collection of tools and data. In the meantime, it 2419has moved to an XML representation of the data. 2420</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id405151"></a>Foomatic's Strange Name</h4></div></div></div><p> 2421<a class="indexterm" name="id405159"></a> 2422“<span class="quote">Why the funny name?</span>” you ask. When it really took off, around spring 2000, CUPS was far less 2423popular than today, and most systems used LPD, LPRng, or even PDQ to print. CUPS shipped with a few generic 2424drivers (good for a few hundred different printer models). These didn't support many device-specific options. 2425CUPS also shipped with its own built-in rasterization filter (<em class="parameter"><code>pstoraster</code></em>, derived from 2426Ghostscript). On the other hand, CUPS provided brilliant support for <span class="emphasis"><em>controlling</em></span> all 2427printer options through standardized and well-defined PPD files. Plus, CUPS was designed to be easily 2428extensible. 2429</p><p> 2430Taylor already had in his database a respectable compilation of facts about many more printers and the 2431Ghostscript “<span class="quote">drivers</span>” they run with. His idea, to generate PPDs from the database information and 2432use them to make standard Ghostscript filters work within CUPS, proved to work very well. It also killed 2433several birds with one stone: 2434</p><div class="itemizedlist"><ul type="disc"><li><p>It made all current and future Ghostscript filter 2435 developments available for CUPS.</p></li><li><p>It made available a lot of additional printer models 2436 to CUPS users (because often the traditional Ghostscript way of 2437 printing was the only one available).</p></li><li><p>It gave all the advanced CUPS options (Web interface, 2438 GUI driver configurations) to users wanting (or needing) to use 2439 Ghostscript filters.</p></li></ul></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id405215"></a>cupsomatic, pdqomatic, lpdomatic, directomatic</h4></div></div></div><p> 2440<a class="indexterm" name="id405223"></a> 2441<a class="indexterm" name="id405230"></a> 2442<a class="indexterm" name="id405237"></a> 2443CUPS worked through a quickly hacked-up filter script named <a href="http://www.linuxprinting.org/download.cgi?filename=cupsomatic&show=0" target="_top">cupsomatic</a>. cupsomatic 2444ran the printfile through Ghostscript, constructing automatically the rather complicated command line needed. 2445It just needed to be copied into the CUPS system to make it work. To configure the way cupsomatic controls the 2446Ghostscript rendering process, it needs a CUPS-PPD. This PPD is generated directly from the contents of the 2447database. For CUPS and the respective printer/filter combo, another Perl script named CUPS-O-Matic did the PPD 2448generation. After that was working, Taylor implemented within a few days a similar thing for two other 2449spoolers. Names chosen for the config-generator scripts were <a href="http://www.linuxprinting.org/download.cgi?filename=lpdomatic&show=0" target="_top">PDQ-O-Matic</a> (for PDQ) 2450and <a href="http://www.linuxprinting.org/download.cgi?filename=lpdomatic&show=0" target="_top">LPD-O-Matic</a> 2451(for you guessed it LPD); the configuration here didn't use PPDs but other 2452spooler-specific files. 2453</p><p> 2454From late summer of that year, <a href="http://www.linuxprinting.org/till/" target="_top">Till Kamppeter</a> started 2455to put work into the database. Kamppeter had been newly employed by <a href="http://www.mandrakesoft.com/" target="_top">Mandrakesoft</a> to convert its printing system over to CUPS, after 2456they had seen his <a href="http://www.fltk.org/" target="_top">FLTK</a>-based <a href="http://cups.sourceforge.net/xpp/" target="_top">XPP</a> (a GUI front-end to the CUPS lp-command). He added a huge 2457amount of new information and new printers. He also developed the support for other spoolers, like <a href="http://ppr.sourceforge.net/" target="_top">PPR</a> (via ppromatic), <a href="http://sourceforge.net/projects/lpr/" target="_top">GNUlpr</a>, and <a href="http://www.lprng.org/" target="_top">LPRng</a> (both via an extended lpdomatic) and spooler-less printing (<a href="http://www.linuxprinting.org/download.cgi?filename=directomatic&show=0" target="_top">directomatic</a>). 2458</p><p> 2459So, to answer your question, “<span class="quote">Foomatic</span>” is the general name for all the overlapping code and data 2460behind the “<span class="quote">*omatic</span>” scripts. Foomatic, up to versions 2.0.x, required (ugly) Perl data 2461structures attached to Linuxprinting.org PPDs for CUPS. It had a different “<span class="quote">*omatic</span>” script for 2462every spooler, as well as different printer configuration files. 2463</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id405353"></a>The <span class="emphasis"><em>Grand Unification</em></span> Achieved</h4></div></div></div><p> 2464<a class="indexterm" name="id405364"></a> 2465This has all changed in Foomatic versions 2.9 (beta) and released as “<span class="quote">stable</span>” 3.0. It has now 2466achieved the convergence of all *omatic scripts and is called the <a href="http://www.linuxprinting.org/foomatic2.9/download.cgi?filename=foomatic-rip&show=0" target="_top">foomatic-rip</a>. 2467This single script is the unification of the previously different spooler-specific *omatic scripts. 2468foomatic-rip is used by all the different spoolers alike, and because it can read PPDs (both the original 2469PostScript printer PPDs and the Linuxprinting.org-generated ones), all of a sudden all supported spoolers can 2470have the power of PPDs at their disposal. Users only need to plug foomatic-rip into their system. For users 2471there is improved media type and source support paper sizes and trays are easier to configure. 2472</p><p> 2473<a class="indexterm" name="id405393"></a> 2474<a class="indexterm" name="id405400"></a> 2475<a class="indexterm" name="id405406"></a> 2476Also, the new generation of Linuxprinting.org PPDs no longer contains Perl data structures. If you are a 2477distro maintainer and have used the previous version of Foomatic, you may want to give the new one a spin, but 2478remember to generate a new-version set of PPDs via the new <a href="http://www.linuxprinting.org/download/foomatic/foomatic-db-engine-3.0.0beta1.tar.gz" target="_top">foomatic-db-engine!</a>. 2479Individual users just need to generate a single new PPD specific to their model by <a href="http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/II.Foomatic-User/II.tutorial-handout-foomatic-user.html" target="_top">following 2480the steps</a> outlined in the Foomatic tutorial or in this chapter. This new development is truly amazing. 2481</p><p> 2482<a class="indexterm" name="id405433"></a> 2483<a class="indexterm" name="id405440"></a> 2484<a class="indexterm" name="id405447"></a> 2485foomatic-rip is a very clever wrapper around the need to run Ghostscript with a different syntax, options, 2486device selections, and/or filters for each different printer or spooler. At the same time, it can read the PPD 2487associated with a print queue and modify the print job according to the user selections. Together with this 2488comes the 100% compliance of the new Foomatic PPDs with the Adobe spec. Some innovative features of the 2489Foomatic concept may surprise users. It will support custom paper sizes for many printers and will support 2490printing on media drawn from different paper trays within the same job (in both cases, even where there is no 2491support for this from Windows-based vendor printer drivers). 2492</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id405462"></a>Driver Development Outside</h4></div></div></div><p> 2493<a class="indexterm" name="id405470"></a> 2494Most driver development itself does not happen within Linuxprinting.org. Drivers are written by independent 2495maintainers. Linuxprinting.org just pools all the information and stores it in its database. In addition, it 2496also provides the Foomatic glue to integrate the many drivers into any modern (or legacy) printing system 2497known to the world. 2498</p><p> 2499Speaking of the different driver development groups, most of the work is currently done in three projects: 2500</p><div class="itemizedlist"><ul type="disc"><li><p> 2501<a class="indexterm" name="id405490"></a> 2502 <a href="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/" target="_top">Omni</a> 2503 a free software project by IBM that tries to convert its printer 2504 driver knowledge from good-ol' OS/2 times into a modern, modular, 2505 universal driver architecture for Linux/UNIX (still beta). This 2506 currently supports 437 models.</p></li><li><p> 2507<a class="indexterm" name="id405513"></a> 2508 <a href="http://hpinkjet.sf.net/" target="_top">HPIJS</a> 2509 a free software project by HP to provide the support for its own 2510 range of models (very mature, printing in most cases is perfect and 2511 provides true photo quality). This currently supports 369 2512 models.</p></li><li><p> 2513<a class="indexterm" name="id405534"></a> 2514 <a href="http://gimp-print.sf.net/" target="_top">Gimp-Print</a> a free software 2515 effort, started by Michael Sweet (also lead developer for CUPS), now 2516 directed by Robert Krawitz, which has achieved an amazing level of 2517 photo print quality (many Epson users swear that its quality is 2518 better than the vendor drivers provided by Epson for the Microsoft 2519 platforms). This currently supports 522 models.</p></li></ul></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id405555"></a>Forums, Downloads, Tutorials, Howtos (Also for Mac OS X and Commercial UNIX)</h4></div></div></div><p> 2520Linuxprinting.org today is the one-stop shop to download printer drivers. Look for printer information and 2521<a href="http://www.linuxprinting.org//kpfeifle/LinuxKongress2002/Tutorial/" target="_top">tutorials</a> or solve 2522printing problems in its popular <a href="http://www.linuxprinting.org/newsportal/" target="_top">forums</a>. This 2523forum is not just for GNU/Linux users, but admins of <a href="http://www.linuxprinting.org/macosx/" target="_top"> 2524commercial UNIX systems</a> are also going there, and the relatively new 2525<a href="http://www.linuxprinting.org/newsportal/thread.php3?name=linuxprinting.macosx.general" target="_top">Mac OS X 2526forum</a> has turned out to be one of the most frequented forums after only a few weeks. 2527</p><p> 2528<a class="indexterm" name="id405594"></a> 2529<a class="indexterm" name="id405601"></a> 2530<a class="indexterm" name="id405607"></a> 2531Linuxprinting.org and the Foomatic driver wrappers around Ghostscript are now a standard tool-chain for 2532printing on all the important distros. Most of them also have CUPS underneath. While in recent years most 2533printer data had been added by Kamppeter, many additional contributions came from engineers with SuSE, Red 2534Hat, Conectiva, Debian, and others. Vendor-neutrality is an important goal of the Foomatic project. Mandrake 2535and Conectiva have merged and are now called Mandriva. 2536</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 2537Till Kamppeter from Mandrakesoft is doing an excellent job in his spare time to maintain Linuxprinting.org and 2538Foomatic. So if you use it often, please send him a note showing your appreciation. 2539</p></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id405626"></a>Foomatic Database-Generated PPDs</h4></div></div></div><p> 2540<a class="indexterm" name="id405634"></a> 2541<a class="indexterm" name="id405641"></a> 2542<a class="indexterm" name="id405648"></a> 2543<a class="indexterm" name="id405655"></a> 2544<a class="indexterm" name="id405662"></a> 2545<a class="indexterm" name="id405668"></a> 2546<a class="indexterm" name="id405675"></a> 2547<a class="indexterm" name="id405682"></a> 2548<a class="indexterm" name="id405689"></a> 2549The Foomatic database is an amazing piece of ingenuity in itself. Not only does it keep the printer and driver 2550information, but it is organized in a way that it can generate PPD files on the fly from its internal 2551XML-based datasets. While these PPDs are modeled to the Adobe specification of PPDs, the 2552Linuxprinting.org/Foomatic-PPDs do not normally drive PostScript printers. They are used to describe all the 2553bells and whistles you could ring or blow on an Epson Stylus inkjet, or an HP Photosmart, or what-have-you. 2554The main trick is one little additional line, not envisaged by the PPD specification, starting with the 2555<em class="parameter"><code>*cupsFilter</code></em> keyword. It tells the CUPS daemon how to proceed with the PostScript print 2556file (old-style Foomatic-PPDs named the cupsomatic filter script, while the new-style PPDs are now call 2557foomatic-rip). This filter script calls Ghostscript on the host system (the recommended variant is ESP 2558Ghostscript) to do the rendering work. foomatic-rip knows which filter or internal device setting it should 2559ask from Ghostscript to convert the PostScript print job into a raster format ready for the target device. 2560This usage of PPDs to describe the options of non-PostScript printers was the invention of the CUPS 2561developers. The rest is easy. GUI tools (like KDE's marvelous <a href="http://printing.kde.org/overview/kprinter.phtml" target="_top">kprinter</a> or the GNOME <a href="http://gtklp.sourceforge.net/" target="_top">gtklp</a> xpp and the CUPS Web interface) read the PPD as well and use 2562this information to present the available settings to the user as an intuitive menu selection. 2563</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id405729"></a>foomatic-rip and Foomatic PPD Download and Installation</h3></div></div></div><p> 2564Here are the steps to install a foomatic-rip-driven LaserJet 4 Plus-compatible 2565printer in CUPS (note that recent distributions of SuSE, UnitedLinux and 2566Mandrake may ship with a complete package of Foomatic-PPDs plus the 2567<code class="literal">foomatic-rip</code> utility. Going directly to 2568Linuxprinting.org ensures that you get the latest driver/PPD files). 2569</p><div class="itemizedlist"><ul type="disc"><li><p>Open your browser at the Linuxprinting.org printer list <a href="http://www.linuxprinting.org/printer_list.cgi" target="_top">page.</a> 2570 </p></li><li><p>Check the complete list of printers in the 2571 <a href="http://www.linuxprinting.org/printer_list.cgi?make=Anyone" target="_top">database.</a>. 2572 </p></li><li><p>Select your model and click on the link. 2573 </p></li><li><p>You'll arrive at a page listing all drivers working with this 2574 model (for all printers, there will always be <span class="emphasis"><em>one</em></span> 2575 recommended driver. Try this one first). 2576 </p></li><li><p>In our case (HP LaserJet 4 Plus), we'll arrive at the default driver for the 2577 <a href="http://www.linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_4_Plus" target="_top">HP-LaserJet 4 Plus.</a> 2578 </p></li><li><p>The recommended driver is ljet4.</p></li><li><p>Several links are provided here. You should visit them all if you 2579 are not familiar with the Linuxprinting.org database. 2580 </p></li><li><p>There is a link to the database page for the 2581 <a href="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4" target="_top">ljet4</a>. 2582 On the driver's page, you'll find important and detailed information 2583 about how to use that driver within the various available 2584 spoolers.</p></li><li><p>Another link may lead you to the home page of the 2585 author of the driver.</p></li><li><p>Important links are the ones that provide hints with 2586 setup instructions for <a href="http://www.linuxprinting.org/cups-doc.html" target="_top">CUPS</a>; 2587 <a href="http://www.linuxprinting.org/pdq-doc.html" target="_top">PDQ</a>; 2588 <a href="http://www.linuxprinting.org/lpd-doc.html" target="_top">LPD, LPRng, and GNUlpr</a>); 2589 as well as <a href="http://www.linuxprinting.org/ppr-doc.html" target="_top">PPR</a> 2590 or “<span class="quote">spoolerless</span>” <a href="http://www.linuxprinting.org/direct-doc.html" target="_top">printing</a>. 2591 </p></li><li><p>You can view the PPD in your browser through this link: 2592 <a href="http://www.linuxprinting.org/ppd-o-matic.cgi?driver=ljet4&printer=HP-LaserJet_4_Plus&show=1" target="_top">http://www.linuxprinting.org/ppd-o-matic.cgi?driver=ljet4&printer=HP-LaserJet_4_Plus&show=1</a> 2593 </p></li><li><p>Most importantly, you can also generate and download 2594 the <a href="http://www.linuxprinting.org/ppd-o-matic.cgi?driver=ljet4&printer=HP-LaserJet_4_Plus&show=0" target="_top">PPD</a>. 2595 </p></li><li><p>The PPD contains all the information needed to use our 2596 model and the driver; once installed, this works transparently 2597 for the user. Later you'll only need to choose resolution, paper size, 2598 and so on, from the Web-based menu, or from the print dialog GUI, or from 2599 the command line.</p></li><li><p>If you ended up on the drivers 2600 <a href="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4" target="_top">page</a>, 2601 you can choose to use the “<span class="quote">PPD-O-Matic</span>” online PPD generator 2602 program.</p></li><li><p>Select the exact model and check either <span class="guilabel">Download</span> or 2603 <span class="guilabel">Display PPD file</span> and click <span class="guilabel">Generate PPD file</span>.</p></li><li><p>If you save the PPD file from the browser view, please 2604 do not use cut and paste (since it could possibly damage line endings 2605 and tabs, which makes the PPD likely to fail its duty), but use <span class="guimenuitem">Save 2606 as...</span> in your browser's menu. (It is best to use the <span class="guilabel">Download</span> option 2607 directly from the Web page.)</p></li><li><p>Another interesting part on each driver page is 2608 the <span class="guimenuitem">Show execution details</span> button. If you 2609 select your printer model and click on that button, 2610 a complete Ghostscript command line will be displayed, enumerating all options 2611 available for that combination of driver and printer model. This is a great way to 2612 “<span class="quote">learn Ghostscript by doing</span>”. It is also an excellent cheat sheet 2613 for all experienced users who need to reconstruct a good command line 2614 for that darned printing script, but can't remember the exact 2615 syntax. </p></li><li><p>Sometime during your visit to Linuxprinting.org, save 2616 the PPD to a suitable place on your hard disk, say 2617 <code class="filename">/path/to/my-printer.ppd</code> (if you prefer to install 2618 your printers with the help of the CUPS Web interface, save the PPD to 2619 the <code class="filename">/usr/share/cups/model/</code> path and restart 2620 cupsd).</p></li><li><p>Then install the printer with a suitable command line, 2621 like this: 2622 </p><pre class="screen"> 2623 <code class="prompt">root# </code><strong class="userinput"><code>lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E \ 2624 -P path/to/my-printer.ppd</code></strong> 2625 </pre></li><li><p>For all the new-style “<span class="quote">Foomatic-PPDs</span>” 2626 from Linuxprinting.org, you also need a special CUPS filter named 2627 foomatic-rip. 2628 </p></li><li><p>The foomatic-rip Perl script itself also makes some 2629 interesting <a href="http://www.linuxprinting.org/foomatic2.9/download.cgi?filename=foomatic-rip&show=1" target="_top">reading</a> 2630 because it is well documented by Kamppeter's in-line comments (even 2631 non-Perl hackers will learn quite a bit about printing by reading 2632 it).</p></li><li><p>Save foomatic-rip either directly in 2633 <code class="filename">/usr/lib/cups/filter/foomatic-rip</code> or somewhere in 2634 your $PATH (and remember to make it world-executable). Again, 2635 do not save by copy and paste but use the appropriate link or the 2636 <span class="guimenuitem">Save as...</span> menu item in your browser.</p></li><li><p>If you save foomatic-rip in your $PATH, create a symlink: 2637 </p><pre class="screen"> 2638 <code class="prompt">root# </code><strong class="userinput"><code>cd /usr/lib/cups/filter/ ; ln -s `which foomatic-rip'</code></strong> 2639 </pre><p> 2640 </p><p> 2641 CUPS will discover this new available filter at startup after restarting 2642 cupsd.</p></li></ul></div><p> 2643Once you print to a print queue set up with the Foomatic PPD, CUPS will insert the appropriate commands and 2644comments into the resulting PostScript job file. foomatic-rip is able to read and act upon these and uses some 2645specially encoded Foomatic comments embedded in the job file. These in turn are used to construct 2646(transparently for you, the user) the complicated Ghostscript command line telling the printer driver exactly 2647how the resulting raster data should look and which printer commands to embed into the data stream. You need: 2648</p><div class="itemizedlist"><ul type="disc"><li><p>A “<span class="quote">foomatic+something</span>” PPD but this is not enough 2649 to print with CUPS (it is only <span class="emphasis"><em>one</em></span> important 2650 component).</p></li><li><p>The <em class="parameter"><code>foomatic-rip</code></em> filter script (Perl) in 2651 <code class="filename">/usr/lib/cups/filters/</code>.</p></li><li><p>Perl to make foomatic-rip run.</p></li><li><p>Ghostscript (because it is doing the main work, 2652 controlled by the PPD/foomatic-rip combo) to produce the raster data 2653 fit for your printer model's consumption.</p></li><li><p>Ghostscript <span class="emphasis"><em>must</em></span> (depending on 2654 the driver/model) contain support for a certain device representing 2655 the selected driver for your model (as shown by <code class="literal">gs -h</code>).</p></li><li><p>foomatic-rip needs a new version of PPDs (PPD versions 2656 produced for cupsomatic do not work with foomatic-rip).</p></li></ul></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id406151"></a>Page Accounting with CUPS</h2></div></div></div><p> 2657<a class="indexterm" name="id406159"></a> 2658Often there are questions regarding print quotas where Samba users (that is, Windows clients) should not be 2659able to print beyond a certain number of pages or data volume per day, week, or month. This feature is 2660dependent on the real print subsystem you're using. Samba's part is always to receive the job files from the 2661clients (filtered <span class="emphasis"><em>or</em></span> unfiltered) and hand them over to this printing subsystem. 2662</p><p> 2663Of course one could hack things with one's own scripts. But then there is CUPS. CUPS supports quotas that can 2664be based on the size of jobs or on the number of pages or both, and can span any time period you want. 2665</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id406181"></a>Setting Up Quotas</h3></div></div></div><p> 2666<a class="indexterm" name="id406189"></a> 2667This is an example command of how root would set a print quota in CUPS, assuming an existing printer named 2668“<span class="quote">quotaprinter</span>”: 2669<a class="indexterm" name="id406203"></a> 2670</p><pre class="screen"> 2671<code class="prompt">root# </code><strong class="userinput"><code>lpadmin -p quotaprinter -o job-quota-period=604800 \ 2672 -o job-k-limit=1024 -o job-page-limit=100</code></strong> 2673</pre><p> 2674This would limit every single user to print no more than 100 pages or 1024 KB of 2675data (whichever comes first) within the last 604,800 seconds ( = 1 week). 2676</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id406232"></a>Correct and Incorrect Accounting</h3></div></div></div><p> 2677For CUPS to count correctly, the printfile needs to pass the CUPS pstops filter; otherwise it uses a dummy 2678count of “<span class="quote">one</span>”. Some print files do not pass it (e.g., image files), but then those are mostly 2679one-page jobs anyway. This also means that proprietary drivers for the target printer running on the client 2680computers and CUPS/Samba, which then spool these files as “<span class="quote">raw</span>” (i.e., leaving them untouched, 2681not filtering them), will be counted as one-pagers too! 2682</p><p> 2683You need to send PostScript from the clients (i.e., run a PostScript driver there) to have the chance to get 2684accounting done. If the printer is a non-PostScript model, you need to let CUPS do the job to convert the file 2685to a print-ready format for the target printer. This is currently working for about a thousand different 2686printer models. Linuxprinting.org has a driver <a href="http://www.linuxprinting.org/printer_list.cgi" target="_top">list</a>. 2687</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id406265"></a>Adobe and CUPS PostScript Drivers for Windows Clients</h3></div></div></div><p> 2688<a class="indexterm" name="id406273"></a> 2689<a class="indexterm" name="id406279"></a> 2690<a class="indexterm" name="id406286"></a> 2691<a class="indexterm" name="id406293"></a> 2692<a class="indexterm" name="id406300"></a> 2693Before CUPS 1.1.16, your only option was to use the Adobe PostScript driver on the Windows clients. The output 2694of this driver was not always passed through the <code class="literal">pstops</code> filter on the CUPS/Samba side, and 2695therefore was not counted correctly (the reason is that it often, depending on the PPD being used, wrote a 2696PJL-header in front of the real PostScript, which caused CUPS to skip <code class="literal">pstops</code> and go 2697directly to the <code class="literal">pstoraster</code> stage). 2698</p><p> 2699From CUPS 1.1.16 and later releases, you can use the CUPS PostScript driver for Windows NT/200x/XP 2700clients (which is tagged in the download area of <code class="filename">http://www.cups.org/</code> as the 2701<code class="filename">cups-samba-1.1.16.tar.gz</code> package). It does <span class="emphasis"><em>not</em></span> work for Windows 27029x/Me clients, but it guarantees: 2703</p><div class="itemizedlist"><ul type="disc"><li><p> <a class="indexterm" name="id406354"></a> To not write a PJL-header.</p></li><li><p>To still read and support all PJL-options named in the 2704 driver PPD with its own means.</p></li><li><p>That the file will pass through the <code class="literal">pstops</code> filter 2705 on the CUPS/Samba server.</p></li><li><p>To page-count correctly the print file.</p></li></ul></div><p> 2706You can read more about the setup of this combination in the man page for <code class="literal">cupsaddsmb</code> (which 2707is only present with CUPS installed, and only current from CUPS 1.1.16). 2708</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id406396"></a>The page_log File Syntax</h3></div></div></div><p> 2709<a class="indexterm" name="id406403"></a> 2710These are the items CUPS logs in the <code class="filename">page_log</code> for every page of a job: 2711</p><div class="itemizedlist"><ul type="disc"><li><p>Printer name</p></li><li><p>User name</p></li><li><p>Job ID</p></li><li><p>Time of printing</p></li><li><p>Page number</p></li><li><p>Number of copies</p></li><li><p>A billing information string (optional)</p></li><li><p>The host that sent the job (included since version 1.1.19)</p></li></ul></div><p> 2712Here is an extract of my CUPS server's <code class="filename">page_log</code> file to illustrate the 2713format and included items: 2714</p><pre class="screen"> 2715tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 1 3 #marketing 10.160.50.13 2716tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 2 3 #marketing 10.160.50.13 2717tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 3 3 #marketing 10.160.50.13 2718tec_IS2027 kurt 401 [22/Apr/2003:10:28:43 +0100] 4 3 #marketing 10.160.50.13 2719Dig9110 boss 402 [22/Apr/2003:10:33:22 +0100] 1 440 finance-dep 10.160.51.33 2720</pre><p> 2721This was job ID <em class="parameter"><code>401</code></em>, printed on <em class="parameter"><code>tec_IS2027</code></em> 2722by user <em class="parameter"><code>kurt</code></em>, a 64-page job printed in three copies, billed to 2723<em class="parameter"><code>#marketing</code></em>, and sent from IP address <code class="constant">10.160.50.13.</code> 2724 The next job had ID <em class="parameter"><code>402</code></em>, was sent by user <em class="parameter"><code>boss</code></em> 2725from IP address <code class="constant">10.160.51.33</code>, printed from one page 440 copies, and 2726is set to be billed to <em class="parameter"><code>finance-dep</code></em>. 2727</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id406532"></a>Possible Shortcomings</h3></div></div></div><p> 2728What flaws or shortcomings are there with this quota system? 2729</p><div class="itemizedlist"><ul type="disc"><li><p>The ones named above (wrongly logged job in case of 2730 printer hardware failure, and so on).</p></li><li><p>In reality, CUPS counts the job pages that are being 2731 processed in <span class="emphasis"><em>software</em></span> (that is, going through the 2732 RIP) rather than the physical sheets successfully leaving the 2733 printing device. Thus, if there is a jam while printing the fifth sheet out 2734 of 1,000 and the job is aborted by the printer, the page count will 2735 still show the figure of 1,000 for that job.</p></li><li><p>All quotas are the same for all users (no flexibility 2736 to give the boss a higher quota than the clerk) and no support for 2737 groups.</p></li><li><p>No means to read out the current balance or the 2738 “<span class="quote">used-up</span>” number of current quota.</p></li><li><p>A user having used up 99 sheets of a 100 quota will 2739 still be able to send and print a 1,000 sheet job.</p></li><li><p>A user being denied a job because of a filled-up quota 2740 does not get a meaningful error message from CUPS other than 2741 “<span class="quote">client-error-not-possible</span>”.</p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id406590"></a>Future Developments</h3></div></div></div><p> 2742This is the best system currently available, and there are huge 2743improvements under development for CUPS 1.2: 2744</p><div class="itemizedlist"><ul type="disc"><li><p>Page counting will go into the backends (these talk 2745 directly to the printer and will increase the count in sync with the 2746 actual printing process; thus, a jam at the fifth sheet will lead to a 2747 stop in the counting).</p></li><li><p>Quotas will be handled more flexibly.</p></li><li><p>Probably there will be support for users to inquire 2748 about their accounts in advance.</p></li><li><p>Probably there will be support for some other tools 2749 around this topic.</p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id406625"></a>Other Accounting Tools</h3></div></div></div><p> 2750Other accounting tools that can be used includes: PrintAnalyzer, pyKota, printbill, LogReport. 2751For more information regarding these tools you can try a Google search. 2752</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id406637"></a>Additional Material</h2></div></div></div><p> 2753A printer queue with <span class="emphasis"><em>no</em></span> PPD associated to it is a 2754“<span class="quote">raw</span>” printer, and all files will go directly there as received by the 2755spooler. The exceptions are file types <em class="parameter"><code>application/octet-stream</code></em> 2756that need the pass-through feature enabled. “<span class="quote">Raw</span>” queues do not do any 2757filtering at all; they hand the file directly to the CUPS backend. 2758This backend is responsible for sending the data to the device 2759(as in the “<span class="quote">device URI</span>” notation: <code class="filename">lpd://, socket://, 2760smb://, ipp://, http://, parallel:/, serial:/, usb:/</code>, and so on). 2761</p><p> 2762cupsomatic/Foomatic are <span class="emphasis"><em>not</em></span> native CUPS drivers 2763and they do not ship with CUPS. They are a third-party add-on 2764developed at Linuxprinting.org. As such, they are a brilliant hack to 2765make all models (driven by Ghostscript drivers/filters in traditional 2766spoolers) also work via CUPS, with the same (good or bad!) quality as 2767in these other spoolers. <em class="parameter"><code>cupsomatic</code></em> is only a vehicle to execute a 2768Ghostscript command line at that stage in the CUPS filtering chain 2769where normally the native CUPS <em class="parameter"><code>pstoraster</code></em> filter would kick 2770in. <em class="parameter"><code>cupsomatic</code></em> bypasses <em class="parameter"><code>pstoraster</code></em>, kidnaps the print file from CUPS, 2771and redirects it to go through Ghostscript. CUPS accepts this 2772because the associated cupsomatic/foomatic-PPD specifies: 2773 2774</p><pre class="programlisting"> 2775*cupsFilter: "application/vnd.cups-postscript 0 cupsomatic" 2776</pre><p> 2777 2778This line persuades CUPS to hand the file to <em class="parameter"><code>cupsomatic</code></em> once it has 2779successfully converted it to the MIME type 2780<em class="parameter"><code>application/vnd.cups-postscript</code></em>. This conversion will not happen for 2781jobs arriving from Windows that are autotyped 2782<em class="parameter"><code>application/octet-stream</code></em>, with the according changes in 2783<code class="filename">/etc/cups/mime.types</code> in place. 2784</p><p> 2785CUPS is widely configurable and flexible, even regarding its filtering 2786mechanism. Another workaround in some situations would be to have in 2787<code class="filename">/etc/cups/mime.types</code> entries as follows: 2788 2789</p><pre class="programlisting"> 2790application/postscript application/vnd.cups-raw 0 - 2791application/vnd.cups-postscript application/vnd.cups-raw 0 - 2792</pre><p> 2793 2794This would prevent all PostScript files from being filtered (rather, 2795they will through the virtual <span class="emphasis"><em>nullfilter</em></span> 2796denoted with “<span class="quote">-</span>”). This could only be useful for PostScript printers. If you 2797want to print PostScript code on non-PostScript printers (provided they support ASCII 2798text printing), an entry as follows could be useful: 2799 2800</p><pre class="programlisting"> 2801*/* application/vnd.cups-raw 0 - 2802</pre><p> 2803 2804and would effectively send <span class="emphasis"><em>all</em></span> files to the 2805backend without further processing. 2806</p><p> 2807You could have the following entry: 2808 2809</p><pre class="programlisting"> 2810application/vnd.cups-postscript application/vnd.cups-raw 0 \ 2811 my_PJL_stripping_filter 2812</pre><p> 2813 2814You will need to write a <em class="parameter"><code>my_PJL_stripping_filter</code></em> 2815(which could be a shell script) that parses the PostScript and removes the 2816unwanted PJL. This needs to conform to CUPS filter design 2817(mainly, receive and pass the parameters printername, job-id, 2818username, jobtitle, copies, print options, and possibly the 2819filename). It is installed as world executable into 2820<code class="filename">/usr/lib/cups/filters/</code> and is called by CUPS 2821if it encounters a MIME type <em class="parameter"><code>application/vnd.cups-postscript</code></em>. 2822</p><p> 2823CUPS can handle <em class="parameter"><code>-o job-hold-until=indefinite</code></em>. 2824This keeps the job in the queue on hold. It will only be printed 2825upon manual release by the printer operator. This is a requirement in 2826many central reproduction departments, where a few operators manage 2827the jobs of hundreds of users on some big machine, where no user is 2828allowed to have direct access (such as when the operators often need 2829to load the proper paper type before running the 10,000 page job 2830requested by marketing for the mailing, and so on). 2831</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id406826"></a>Autodeletion or Preservation of CUPS Spool Files</h2></div></div></div><p> 2832<a class="indexterm" name="id406834"></a> 2833<a class="indexterm" name="id406840"></a> 2834<a class="indexterm" name="id406847"></a> 2835Samba print files pass through two spool directories. One is the incoming directory managed by Samba (set in 2836the <a class="indexterm" name="id406855"></a>path = /var/spool/samba directive in the <em class="parameter"><code>[printers]</code></em> section of <code class="filename">smb.conf</code>). The other is the spool directory of your UNIX print subsystem. For 2837CUPS it is normally <code class="filename">/var/spool/cups/</code>, as set by the <code class="filename">cupsd.conf</code> 2838directive <code class="filename">RequestRoot /var/spool/cups</code>. 2839</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id406894"></a>CUPS Configuration Settings Explained</h3></div></div></div><p> 2840Some important parameter settings in the CUPS configuration file 2841<code class="filename">cupsd.conf</code> are: 2842</p><div class="variablelist"><dl><dt><span class="term">PreserveJobHistory Yes</span></dt><dd><p> 2843 This keeps some details of jobs in cupsd's mind (well, it keeps the 2844 c12345, c12346, and so on, files in the CUPS spool directory, which does a 2845 similar job as the old-fashioned BSD-LPD control files). This is set 2846 to “<span class="quote">Yes</span>” as a default. 2847 </p></dd><dt><span class="term">PreserveJobFiles Yes</span></dt><dd><p> 2848 This keeps the job files themselves in cupsd's mind 2849 (it keeps the d12345, d12346, etc., files in the CUPS spool 2850 directory). This is set to “<span class="quote">No</span>” as the CUPS 2851 default. 2852 </p></dd><dt><span class="term">“<span class="quote">MaxJobs 500</span>”</span></dt><dd><p> 2853 This directive controls the maximum number of jobs 2854 that are kept in memory. Once the number of jobs reaches the limit, 2855 the oldest completed job is automatically purged from the system to 2856 make room for the new one. If all of the known jobs are still 2857 pending or active, then the new job will be rejected. Setting the 2858 maximum to 0 disables this functionality. The default setting is 2859 0. 2860 </p></dd></dl></div><p> 2861(There are also additional settings for <em class="parameter"><code>MaxJobsPerUser</code></em> and 2862<em class="parameter"><code>MaxJobsPerPrinter</code></em>.) 2863</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id406971"></a>Preconditions</h3></div></div></div><p> 2864For everything to work as it should, you need to have three things: 2865</p><div class="itemizedlist"><ul type="disc"><li><p>A Samba smbd that is compiled against <code class="filename">libcups</code> (check 2866 on Linux by running <strong class="userinput"><code>ldd `which smbd'</code></strong>).</p></li><li><p>A Samba-<code class="filename">smb.conf</code> setting of 2867 <a class="indexterm" name="id407008"></a>printing = cups.</p></li><li><p>Another Samba <code class="filename">smb.conf</code> setting of 2868 <a class="indexterm" name="id407026"></a>printcap = cups.</p></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 2869In this case, all other manually set printing-related commands (like 2870<a class="indexterm" name="id407039"></a>print command, 2871<a class="indexterm" name="id407046"></a>lpq command, 2872<a class="indexterm" name="id407053"></a>lprm command, 2873<a class="indexterm" name="id407060"></a>lppause command, and 2874<a class="indexterm" name="id407067"></a>lpresume command) are ignored, and they should normally have no 2875influence whatsoever on your printing. 2876</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407077"></a>Manual Configuration</h3></div></div></div><p> 2877If you want to do things manually, replace the <a class="indexterm" name="id407086"></a>printing = cups 2878by <a class="indexterm" name="id407093"></a>printing = bsd. Then your manually set commands may work 2879(I haven't tested this), and a <a class="indexterm" name="id407100"></a>print command = lp -d %P %s; rm %s 2880may do what you need. 2881</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id407111"></a>Printing from CUPS to Windows-Attached Printers</h2></div></div></div><p> 2882<a class="indexterm" name="id407119"></a> 2883<a class="indexterm" name="id407126"></a> 2884From time to time the question arises, how can you print <span class="emphasis"><em>to</em></span> a Windows-attached printer 2885<span class="emphasis"><em>from</em></span> Samba? Normally the local connection from Windows host to printer would be done by 2886USB or parallel cable, but this does not matter to Samba. From here only an SMB connection needs to be opened 2887to the Windows host. Of course, this printer must be shared first. As you have learned by now, CUPS uses 2888<span class="emphasis"><em>backends</em></span> to talk to printers and other servers. To talk to Windows shared printers, you 2889need to use the <code class="filename">smb</code> (surprise, surprise!) backend. Check if this is in the CUPS backend 2890directory. This usually resides in <code class="filename">/usr/lib/cups/backend/</code>. You need to find an 2891<code class="filename">smb</code> file there. It should be a symlink to <code class="filename">smbspool</code>, and the file 2892must exist and be executable: 2893</p><pre class="screen"> 2894<code class="prompt">root# </code><strong class="userinput"><code>ls -l /usr/lib/cups/backend/</code></strong> 2895total 253 2896drwxr-xr-x 3 root root 720 Apr 30 19:04 . 2897drwxr-xr-x 6 root root 125 Dec 19 17:13 .. 2898-rwxr-xr-x 1 root root 10692 Feb 16 21:29 canon 2899-rwxr-xr-x 1 root root 10692 Feb 16 21:29 epson 2900lrwxrwxrwx 1 root root 3 Apr 17 22:50 http -> ipp 2901-rwxr-xr-x 1 root root 17316 Apr 17 22:50 ipp 2902-rwxr-xr-x 1 root root 15420 Apr 20 17:01 lpd 2903-rwxr-xr-x 1 root root 8656 Apr 20 17:01 parallel 2904-rwxr-xr-x 1 root root 2162 Mar 31 23:15 pdfdistiller 2905lrwxrwxrwx 1 root root 25 Apr 30 19:04 ptal -> /usr/sbin/ptal-cups 2906-rwxr-xr-x 1 root root 6284 Apr 20 17:01 scsi 2907lrwxrwxrwx 1 root root 17 Apr 2 03:11 smb -> /usr/bin/smbspool 2908-rwxr-xr-x 1 root root 7912 Apr 20 17:01 socket 2909-rwxr-xr-x 1 root root 9012 Apr 20 17:01 usb 2910 2911<code class="prompt">root# </code><strong class="userinput"><code>ls -l `which smbspool`</code></strong> 2912-rwxr-xr-x 1 root root 563245 Dec 28 14:49 /usr/bin/smbspool 2913</pre><p> 2914If this symlink does not exist, create it: 2915</p><pre class="screen"> 2916<code class="prompt">root# </code><strong class="userinput"><code>ln -s `which smbspool` /usr/lib/cups/backend/smb</code></strong> 2917</pre><p> 2918<a class="indexterm" name="id407234"></a> 2919<a class="indexterm" name="id407241"></a> 2920<code class="literal">smbspool</code> was written by Mike Sweet from the CUPS folks. It is included and ships with 2921Samba. It may also be used with print subsystems other than CUPS, to spool jobs to Windows printer shares. To 2922set up printer <em class="replaceable"><code>winprinter</code></em> on CUPS, you need to have a driver for it. Essentially 2923this means to convert the print data on the CUPS/Samba host to a format that the printer can digest (the 2924Windows host is unable to convert any files you may send). This also means you should be able to print to the 2925printer if it were hooked directly at your Samba/CUPS host. For troubleshooting purposes, this is what you 2926should do to determine if that part of the process chain is in order. Then proceed to fix the network 2927connection/authentication to the Windows host, and so on. 2928</p><p> 2929To install a printer with the <em class="parameter"><code>smb</code></em> backend on CUPS, use this command: 2930</p><pre class="screen"> 2931<code class="prompt">root# </code><strong class="userinput"><code>lpadmin -p winprinter -v smb://WINDOWSNETBIOSNAME/printersharename \ 2932 -P /path/to/PPD</code></strong> 2933</pre><p> 2934<a class="indexterm" name="id407294"></a> 2935<a class="indexterm" name="id407301"></a> 2936<a class="indexterm" name="id407307"></a> 2937The PPD must be able to direct CUPS to generate the print data for the target model. For PostScript printers, 2938just use the PPD that would be used with the Windows NT PostScript driver. But what can you do if the printer 2939is only accessible with a password? Or if the printer's host is part of another workgroup? This is provided 2940for: You can include the required parameters as part of the <code class="filename">smb://</code> device-URI like this: 2941</p><div class="itemizedlist"><ul type="disc"><li><p><code class="filename">smb://WORKGROUP/WINDOWSNETBIOSNAME/printersharename</code></p></li><li><p><code class="filename">smb://username:password@WORKGROUP/WINDOWSNETBIOSNAME/printersharename</code></p></li><li><p><code class="filename">smb://username:password@WINDOWSNETBIOSNAME/printersharename</code></p></li></ul></div><p> 2942Note that the device URI will be visible in the process list of the Samba server (e.g., when someone uses the 2943<code class="literal">ps -aux</code> command on Linux), even if the username and passwords are sanitized before they get 2944written into the log files. This is an inherently insecure option; however, it is the only one. Don't use it 2945if you want to protect your passwords. Better share the printer in a way that does not require a password! 2946Printing will only work if you have a working NetBIOS name resolution up and running. Note that this is a 2947feature of CUPS and you do not necessarily need to have smbd running. 2948 2949</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id407368"></a>More CUPS Filtering Chains</h2></div></div></div><p> 2950The diagrams in <a href="CUPS-printing.html#cups1" title="Figure�22.17.�Filtering Chain 1.">Filtering Chain 1</a> and <a href="CUPS-printing.html#cups2" title="Figure�22.18.�Filtering Chain with cupsomatic">Filtering Chain with 2951cupsomatic</a> show how CUPS handles print jobs. 2952</p><div class="figure"><a name="cups1"></a><p class="title"><b>Figure�22.17.�Filtering Chain 1.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/cups1.png" alt="Filtering Chain 1."></div></div></div><br class="figure-break"><div class="figure"><a name="cups2"></a><p class="title"><b>Figure�22.18.�Filtering Chain with cupsomatic</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/cups2.png" width="243" alt="Filtering Chain with cupsomatic"></div></div></div><br class="figure-break"></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id407477"></a>Common Errors</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407482"></a>Windows 9x/Me Client Can't Install Driver</h3></div></div></div><p>For Windows 9x/Me, clients require the printer names to be eight 2953 characters (or “<span class="quote">8 plus 3 chars suffix</span>”) max; otherwise, the driver files 2954 will not get transferred when you want to download them from Samba.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="root-ask-loop"></a>“<span class="quote">cupsaddsmb</span>” Keeps Asking for Root Password in Never-ending Loop</h3></div></div></div><p>Have you set <a class="indexterm" name="id407512"></a>security = user? Have 2955 you used <code class="literal">smbpasswd</code> to give root a Samba account? 2956 You can do two things: open another terminal and execute 2957 <code class="literal">smbpasswd -a root</code> to create the account and 2958 continue entering the password into the first terminal. Or, break 2959 out of the loop by pressing Enter twice (without trying to type a 2960 password).</p><p> 2961 If the error is “<span class="quote">Tree connect failed: NT_STATUS_BAD_NETWORK_NAME</span>”, 2962 you may have forgotten to create the <code class="filename">/etc/samba/drivers</code> directory. 2963 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407549"></a>“<span class="quote">cupsaddsmb</span>” or “<span class="quote">rpcclient addriver</span>” Emit Error</h3></div></div></div><p> 2964 If <code class="literal">cupsaddsmb</code>, or <code class="literal">rpcclient addriver</code> emit the error message 2965 WERR_BAD_PASSWORD, refer to <a href="CUPS-printing.html#root-ask-loop" title="“cupsaddsmb” Keeps Asking for Root Password in Never-ending Loop">the previous common error</a>. 2966 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407585"></a>“<span class="quote">cupsaddsmb</span>” Errors</h3></div></div></div><p> 2967 The use of “<span class="quote">cupsaddsmb</span>” gives “<span class="quote">No PPD file for printer...</span>” 2968 message while PPD file is present. What might the problem be? 2969 </p><p> 2970 Have you enabled printer sharing on CUPS? This means, do you have a <code class="literal"><Location 2971 /printers>....</Location></code> section in CUPS server's <code class="filename">cupsd.conf</code> that 2972 does not deny access to the host you run “<span class="quote">cupsaddsmb</span>” from? It <span class="emphasis"><em>could</em></span> be an 2973 issue if you use cupsaddsmb remotely, or if you use it with a <code class="option">-h</code> parameter: 2974 <strong class="userinput"><code>cupsaddsmb -H sambaserver -h cupsserver -v printername</code></strong>. 2975 </p><p>Is your <em class="parameter"><code>TempDir</code></em> directive in 2976 <code class="filename">cupsd.conf</code> set to a valid value, and is it writable? 2977 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407655"></a>Client Can't Connect to Samba Printer</h3></div></div></div><p>Use <code class="literal">smbstatus</code> to check which user 2978 you are from Samba's point of view. Do you have the privileges to 2979 write into the <em class="parameter"><code>[print$]</code></em> 2980 share?</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407678"></a>New Account Reconnection from Windows 200x/XP Troubles</h3></div></div></div><p> 2981Once you are connected as the wrong user (for example, as <code class="constant">nobody</code>, which often occurs if 2982you have <a class="indexterm" name="id407691"></a>map to guest = bad user), Windows Explorer will not accept an 2983attempt to connect again as a different user. There will not be any bytes transferred on the wire to Samba, 2984but still you'll see a stupid error message that makes you think Samba has denied access. Use 2985<code class="literal">smbstatus</code> to check for active connections. Kill the PIDs. You still can't re-connect, and 2986you get the dreaded <code class="computeroutput">You can't connect with a second account from the same 2987machine</code> message as soon as you try. And you do not see a single byte arriving at Samba (see 2988logs; use “<span class="quote">ethereal</span>”) indicating a renewed connection attempt. Shut all Explorer Windows. This 2989makes Windows forget what it has cached in its memory as established connections. Then reconnect as the right 2990user. The best method is to use a DOS terminal window and <span class="emphasis"><em>first</em></span> do <strong class="userinput"><code>net use z: 2991\\GANDALF\print$ /user:root</code></strong>. Check with <code class="literal">smbstatus</code> that you are 2992connected under a different account. Now open the <span class="guilabel">Printers</span> folder (on the Samba server in 2993the <span class="guilabel">Network Neighborhood</span>), right-click on the printer in question, and select 2994<span class="guibutton">Connect....</span>. 2995</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407756"></a>Avoid Being Connected to the Samba Server as the Wrong User</h3></div></div></div><p> 2996<a class="indexterm" name="id407764"></a> 2997You see per <code class="literal">smbstatus</code> that you are connected as user nobody, but you want to be root or 2998printer admin. This is probably due to <a class="indexterm" name="id407778"></a>map to guest = bad user, which 2999silently connected you under the guest account when you gave (maybe by accident) an incorrect username. Remove 3000<a class="indexterm" name="id407786"></a>map to guest if you want to prevent this. 3001</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407795"></a>Upgrading to CUPS Drivers from Adobe Drivers</h3></div></div></div><p> 3002This information came from a mailing list posting regarding problems experienced when 3003upgrading from Adobe drivers to CUPS drivers on Microsoft Windows NT/200x/XP clients. 3004</p><p>First delete all old Adobe-using printers. Then delete all old Adobe drivers. (On Windows 200x/XP, right-click in 3005the background of <span class="guilabel">Printers</span> folder, select <span class="guimenuitem">Server Properties...</span>, select 3006tab <span class="guilabel">Drivers</span>, and delete here).</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407830"></a>Can't Use “<span class="quote">cupsaddsmb</span>” on Samba Server, Which Is a PDC</h3></div></div></div><p>Do you use the “<span class="quote">naked</span>” root user name? Try to do it 3007this way: <strong class="userinput"><code>cupsaddsmb -U <em class="replaceable"><code>DOMAINNAME</code></em>\\root -v 3008<em class="replaceable"><code>printername</code></em></code></strong>> (note the two backslashes: the first one is 3009required to “<span class="quote">escape</span>” the second one).</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407864"></a>Deleted Windows 200x Printer Driver Is Still Shown</h3></div></div></div><p>Deleting a printer on the client will not delete the 3010driver too (to verify, right-click on the white background of the 3011<span class="guilabel">Printers</span> folder, select <span class="guimenuitem">Server Properties</span> and click on the 3012<span class="guilabel">Drivers</span> tab). These same old drivers will be re-used when you try to 3013install a printer with the same name. If you want to update to a new 3014driver, delete the old ones first. Deletion is only possible if no 3015other printer uses the same driver.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407895"></a>Windows 200x/XP Local Security Policies</h3></div></div></div><a class="indexterm" name="id407901"></a><a class="indexterm" name="id407908"></a><p>Local security policies may not allow the installation of unsigned drivers “<span class="quote">local 3016security policies</span>” may not allow the installation of printer drivers at all.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407926"></a>Administrator Cannot Install Printers for All Local Users</h3></div></div></div><p> 3017<a class="indexterm" name="id407934"></a> 3018<a class="indexterm" name="id407941"></a> 3019Windows XP handles SMB printers on a “<span class="quote">per-user</span>” basis. 3020This means every user needs to install the printer himself or herself. To have a printer available for 3021everybody, you might want to use the built-in IPP client capabilities of Win XP. Add a printer with the print 3022path of <em class="parameter"><code>http://cupsserver:631/printers/printername</code></em>. We're still looking into this one. 3023Maybe a logon script could automatically install printers for all users. 3024</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407963"></a>Print Change, Notify Functions on NT Clients</h3></div></div></div><p>For print change, notify functions on NT++ clients. These need to run the <code class="literal">Server</code> 3025service first (renamed to <code class="literal">File & Print Sharing for MS Networks</code> in XP).</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id407987"></a>Win XP-SP1</h3></div></div></div><p>Win XP-SP1 introduced a Point and Print Restriction Policy (this restriction does not apply to 3026“<span class="quote">Administrator</span>” or “<span class="quote">Power User</span>” groups of users). In Group Policy Object Editor, go 3027to <span class="guimenu">User Configuration -> Administrative Templates -> Control Panel -> Printers</span>. The policy 3028is automatically set to <code class="constant">Enabled</code> and the <code class="constant">Users can only Point and Print to 3029machines in their Forest</code> . You probably need to change it to <code class="constant">Disabled</code> or 3030<code class="constant">Users can only Point and Print to these servers</code> to make driver downloads from Samba 3031possible. 3032</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id408028"></a>Print Options for All Users Can't Be Set on Windows 200x/XP</h3></div></div></div><p>How are you doing it? I bet the wrong way (it is not easy to find out, though). There are three 3033different ways to bring you to a dialog that <span class="emphasis"><em>seems</em></span> to set everything. All three dialogs 3034<span class="emphasis"><em>look</em></span> the same, yet only one of them does what you intend. You need to be Administrator or 3035Print Administrator to do this for all users. Here is how I do in on XP: 3036</p><div class="orderedlist"><ol type="A"><li><p>The first wrong way: 3037 3038 </p><div class="orderedlist"><ol type="I"><li><p>Open the <span class="guilabel">Printers</span> 3039 folder.</p></li><li><p>Right-click on the printer 3040 (<span class="guilabel">remoteprinter on cupshost</span>) and 3041 select in context menu <span class="guimenuitem">Printing 3042 Preferences...</span></p></li><li><p>Look at this dialog closely and remember what it looks like.</p></li></ol></div><p> 3043 </p></li><li><p>The second wrong way: 3044 </p><div class="orderedlist"><ol type="I"><li><p>Open the <span class="guilabel">Printers</span> folder.</p></li><li><p>Right-click on the printer (<span class="guilabel">remoteprinter on 3045 cupshost</span>) and select the context menu 3046 <span class="guimenuitem">Properties</span>.</p></li><li><p>Click on the <span class="guilabel">General</span> tab.</p></li><li><p>Click on the button <span class="guibutton">Printing 3047 Preferences...</span></p></li><li><p>A new dialog opens. Keep this dialog open and go back 3048 to the parent dialog.</p></li></ol></div><p> 3049 </p></li><li><p>The third and correct way: 3050 </p><div class="orderedlist"><ol type="I"><li><p>Open the <span class="guilabel">Printers</span> folder.</p></li><li><p>Right-click on the printer (<span class="guilabel">remoteprinter on 3051 cupshost</span>) and select the context menu 3052 <span class="guimenuitem">Properties</span>.</p></li><li><p>Click on the <span class="guilabel">Advanced</span> 3053 tab. (If everything is “<span class="quote">grayed out,</span>” then you are not logged 3054 in as a user with enough privileges).</p></li><li><p>Click on the <span class="guibutton">Printing 3055 Defaults...</span> button.</p></li><li><p>On any of the two new tabs, click on the 3056 <span class="guibutton">Advanced...</span> button.</p></li><li><p>A new dialog opens. Compare this one to the other 3057 identical-looking one from step “<span class="quote">B.5</span>” or A.3".</p></li></ol></div><p> 3058 </p></li></ol></div><p> 3059Do you see any difference? I don't either. However, only the last one, which you arrived at with steps 3060“<span class="quote">C.1. to C.6.</span>”, will save any settings permanently and be the defaults for new users. If you want 3061all clients to get the same defaults, you need to conduct these steps <span class="emphasis"><em>as Administrator</em></span> 3062(<a class="indexterm" name="id408262"></a>printer admin in <code class="filename">smb.conf</code>) <span class="emphasis"><em>before</em></span> a client downloads the 3063driver (the clients can later set their own <span class="emphasis"><em>per-user defaults</em></span> by following the procedures 3064<span class="emphasis"><em>A</em></span> or <span class="emphasis"><em>B</em></span>). 3065</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id408292"></a>Most Common Blunders in Driver Settings on Windows Clients</h3></div></div></div><p> 3066Don't use <em class="parameter"><code>Optimize for Speed</code></em>, but use <em class="parameter"><code>Optimize for Portability</code></em> 3067instead (Adobe PS Driver). Don't use <em class="parameter"><code>Page Independence: No</code></em>. Always settle with 3068<em class="parameter"><code>Page Independence: Yes</code></em> (Microsoft PS Driver and CUPS PS Driver for Windows NT/200x/XP). 3069If there are problems with fonts, use <em class="parameter"><code>Download as Softfont into printer</code></em> (Adobe PS 3070Driver). For <span class="guilabel">TrueType Download Options</span> choose <code class="constant">Outline</code>. Use 3071PostScript Level 2 if you are having trouble with a non-PS printer and if there is a choice. 3072</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id408345"></a><code class="literal">cupsaddsmb</code> Does Not Work with Newly Installed Printer</h3></div></div></div><p> 3073Symptom: The last command of <code class="literal">cupsaddsmb</code> does not complete successfully. If the <code class="literal">cmd 3074= setdriver printername printername</code> result was NT_STATUS_UNSUCCESSFUL, then possibly the printer was 3075not yet recognized by Samba. Did it show up in Network Neighborhood? Did it show up in <code class="literal">rpcclient 3076hostname -c `enumprinters'</code>? Restart smbd (or send a <code class="literal">kill -HUP</code> to all processes 3077listed by <code class="literal">smbstatus</code>, and try again. 3078</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id408391"></a>Permissions on <code class="filename">/var/spool/samba/</code> Get Reset After Each Reboot</h3></div></div></div><p> 3079Have you ever by accident set the CUPS spool directory to the same location (<em class="parameter"><code>RequestRoot 3080/var/spool/samba/</code></em> in <code class="filename">cupsd.conf</code> or the other way round: 3081<code class="filename">/var/spool/cups/</code> is set as <a class="indexterm" name="id408424"></a>path> in the <em class="parameter"><code>[printers]</code></em> section)? These <em class="parameter"><code>must</code></em> be different. Set <em class="parameter"><code>RequestRoot 3082/var/spool/cups/</code></em> in <code class="filename">cupsd.conf</code> and <a class="indexterm" name="id408455"></a>path = 3083/var/spool/samba in the <em class="parameter"><code>[printers]</code></em> section of <code class="filename">smb.conf</code>. Otherwise, 3084cupsd will sanitize permissions to its spool directory with each restart and printing will not work reliably. 3085</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id408477"></a>Print Queue Called “<span class="quote">lp</span>” Mishandles Print Jobs</h3></div></div></div><p> 3086In this case a print queue called “<span class="quote">lp</span>” intermittently swallows jobs and 3087spits out completely different ones from what was sent. 3088</p><p> 3089<a class="indexterm" name="id408496"></a> 3090<a class="indexterm" name="id408503"></a> 3091<a class="indexterm" name="id408510"></a> 3092It is a bad idea to name any printer “<span class="quote">lp</span>”. This is the traditional UNIX name for the default 3093printer. CUPS may be set up to do an automatic creation of Implicit Classes. This means, to group all printers 3094with the same name to a pool of devices and load-balance the jobs across them in a round-robin fashion. 3095Chances are high that someone else has a printer named “<span class="quote">lp</span>” too. You may receive that person's 3096jobs and send your own to his or her device unwittingly. To have tight control over the printer names, set 3097<em class="parameter"><code>BrowseShortNames No</code></em>. It will present any printer as 3098<em class="replaceable"><code>printername@cupshost</code></em>, which gives you better control over what may happen in a 3099large networked environment. 3100</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id408540"></a>Location of Adobe PostScript Driver Files for “<span class="quote">cupsaddsmb</span>”</h3></div></div></div><p> 3101Use <code class="literal">smbclient</code> to connect to any Windows box with a shared PostScript printer: 3102<code class="literal">smbclient //windowsbox/print\$ -U guest</code>. You can navigate to the 3103<code class="filename">W32X86/2</code> subdir to <code class="literal">mget ADOBE*</code> and other files or to 3104<code class="filename">WIN40/0</code> to do the same. Another option is to download the <code class="filename">*.exe</code> 3105packaged files from the Adobe Web site. 3106</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id408591"></a>Overview of the CUPS Printing Processes</h2></div></div></div><p> 3107A complete overview of the CUPS printing processes can be found in <a href="CUPS-printing.html#a_small" title="Figure�22.19.�CUPS Printing Overview.">the CUPS 3108Printing Overview diagram</a>. 3109</p><div class="figure"><a name="a_small"></a><p class="title"><b>Figure�22.19.�CUPS Printing Overview.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/a_small.png" width="243" alt="CUPS Printing Overview."></div></div></div><br class="figure-break"></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id398861" href="#id398861">6</a>] </sup>See also <a href="http://www.cups.org/cups-help.html" target="_top">http://www.cups.org/cups-help.html</a></p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="classicalprinting.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="optional.html">Up</a></td><td width="40%" align="right">�<a accesskey="n" href="VFS.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter�21.�Classical Printing Support�</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">�Chapter�23.�Stackable VFS modules</td></tr></table></div></body></html> 3110