- Add some entities for authors
[abartlet/samba.git/.git] / docs / docbook / projdoc / CUPS-printing.sgml
1 <chapter id="CUPS-printing">
2
3
4 <chapterinfo>
5         &author.jht;
6         <author>
7                 <firstname>Kurt</firstname><surname>Pfeifle</surname>
8                 <affiliation>
9                         <address><email>kpfeifle@danka.de</email></address>
10                 </affiliation>
11         </author>
12         <pubdate> (25 March 2003) </pubdate>
13 </chapterinfo>
14
15 <title>CUPS Printing Support</title>
16
17 <sect1>
18 <title>Introduction</title>
19         
20 <para>
21 The Common Unix Print System (CUPS) has become very popular, but to many it is
22 a very mystical tool. There is a great deal of uncertainty regarding CUPS and how
23 it works. The result is seen in a large number of posting on the samba mailing lists
24 expressing frustration when MS Windows printers appear not to work with a CUPS
25 backr-end.
26 /para>
27
28 <para>
29 This is a good time to point out how CUPS can be used and what it does. CUPS is more
30 than just a print spooling system - it is a complete printer management system that
31 complies with HTTP and IPP protocols. It can be managed remotely via a web browser
32 and it can print using http and ipp protocols.
33 </para>
34
35 <para>
36 CUPS allows to creation of RAW printers (ie: NO file format translation) as well as
37 SMART printers (ie: CUPS does file format conversion as required for the printer). In
38 many ways this gives CUPS similar capabilities to the MS Windows print monitoring
39 system. Of course, if you are a CUPS advocate, you would agrue that CUPS is better!
40 In any case, let us now move on to explore how one may configure CUPS for interfacing
41 with MS Windows print clients via Samba.
42 </para>
43
44 <para>
45 <ulink url="http://www.cups.org/">CUPS</ulink> is a newcomer in the UNIX printing scene,
46 which has convinced many people upon first trial already. However, it has quite a few
47 new features, which make it different from other, more traditional printing systems.
48 </para>
49
50 </sect1>
51
52 <sect1>
53 <title>Configuring <filename>smb.conf</filename> for CUPS</title>
54
55 <para>
56 Printing with CUPS in the most basic <filename>smb.conf</filename>
57 setup in Samba-3  only needs two settings: <command>printing = cups</command> and
58 <command>printcap = cups</command>. While CUPS itself doesn't need a printcap
59 anymore, the <filename>cupsd.conf</filename> configuration file knows two directives
60 (example: <command>Printcap /etc/printcap</command> and <command>PrintcapFormat
61 BSD</command>), which control if such a file should be created for the
62 convenience of third party applications. Make sure it is set! For details see
63 <command>man cupsd.conf</command> and other CUPS-related documentation.
64 </para>
65
66 <para>
67 If SAMBA is compiled against libcups, then <command>printcap = cups</command> uses the
68 CUPS API to list printers, submit jobs, etc. Otherwise it maps to the System V commands
69 with an additional <parameter>-oraw</parameter> option for printing. On a Linux system,
70 you can use the <command>ldd</command> command to find out details (ldd may not be
71 present on other OS platforms, or its function may be embodied by a different command):
72 </para>
73
74 <para>
75 <programlisting>transmeta:/home/kurt # ldd `which smbd`
76         libssl.so.0.9.6 => /usr/lib/libssl.so.0.9.6 (0x4002d000)
77         libcrypto.so.0.9.6 => /usr/lib/libcrypto.so.0.9.6 (0x4005a000)
78         libcups.so.2 => /usr/lib/libcups.so.2 (0x40123000)
79         libdl.so.2 => /lib/libdl.so.2 (0x401e8000)
80         libnsl.so.1 => /lib/libnsl.so.1 (0x401ec000)
81         libpam.so.0 => /lib/libpam.so.0 (0x40202000)
82         libc.so.6 => /lib/libc.so.6 (0x4020b000)
83         /lib/ld-linux.so.2 =&gt; /lib/ld-linux.so.2 (0x40000000)
84 </programlisting></para>
85
86 <para>
87 The line "libcups.so.2 =&gt; /usr/lib/libcups.so.2
88 (0x40123000)" shows there is CUPS support compiled into this version of
89 Samba. If this is the case, and <command>printing = cups</command> is set, then any
90 otherwise manually set print command in smb.conf is ignored.
91 </para>
92 </sect1>
93
94 <sect1>
95 <title>CUPS - RAW Print Through Mode</title>
96
97 <note>
98 <para>
99 When used in raw print through mode is will be necessary to use the printer
100 vendor's drivers in each Windows client PC.
101 </para>
102 </note>
103
104 <para>
105 When CUPS printers are configured for RAW print-through mode operation it is the
106 responsibility of the Samba client to fully render the print job (file) in a format
107 that is suitable for direct delivery to the printer. In this case CUPS will NOT
108 do any print file format conversion work.
109 </para>
110
111 <para>
112 The CUPS files that need to be correctly set for RAW mode printers to work are:
113
114 <itemizedlist>
115         <listitem><para><filename>/etc/cups/mime.types</filename><para></listitem>
116         <listitem><para><filename>/etc/cups/mime.convs</filename><para></listitem>
117 </itemizedlist>
118
119 Both contain entries that must be uncommented to allow <emphasis>RAW</emphasis> mode
120 operation.
121 </para>
122
123 <para>
124 Firstly, to enable CUPS based printing from Samba the following options must be
125 enabled in your smb.conf file [globals] section:
126
127 <itemizedlist>
128         <listitem><para>printing = CUPS</para></listitem>
129
130         <listitem><para>printcap = CUPS</para></listitem>
131 </itemizedlist>
132
133 When these parameters are specified the print directives in smb.conf (as well as in
134 samba itself) will be ignored because samba will directly interface with CUPS through
135 it's application program interface (API) - so long as Samba has been compiled with
136 CUPS library (libcups) support. If samba has NOT been compiled with CUPS support then
137 printing will use the System V AT&amp;T command set with the <emphasis>-oraw</emphasis> 
138 option automatically passing through.
139 </para>
140
141 <para>
142 Cupsomatic (an enhanced printing utility that is part of some CUPS implementations) 
143 on the Samba/CUPS server does *not* add any features if a file is really
144 printed "raw".  However, if you have loaded the driver for the Windows client from
145 the CUPS server, using the "cupsaddsmb" utility, and if this driver is one using
146 a "Foomatic" PPD, the PJL header in question is already added on the Windows client,
147 at the time when the driver initially generated the PostScript data and CUPS in true
148 "-oraw" manner doesn't remove this PJL header and passes the file "as is" to its
149 printer communication backend.
150 </para>
151
152 <note><para>NOTE: editing in the "mime.convs" and the "mime.types" file does not *enforce*
153 "raw" printing, it only *allows* it.</para></note>
154
155 <para>
156 Print files that arrive from MS Windows printing are "auto-typed" by CUPS. This aids
157 the process of determining proper treatment while in the print queue system.
158
159 <itemizedlist>
160         <listitem><para>
161         Files generated by PCL drivers and directed at PCK printers get auto-typed as
162         <filename>application/octet-stream</filename>. Unknown file format types also
163         get auto-typed with this tag.
164         </para></listitem>
165
166         <listitem><para>
167         Files generated by a Postscript driver and directed at a Postscript printer
168         are auto-typed depending on the auto-detected most suitable MIME type as:
169
170         <itemizedlist>
171                 <listitem><para>* application/postscript</para></listitem>
172                 <listitem><para>* application/vnd.cups-postscript</para></listitem>
173         </itemizedlist>
174         </para>
175 </itemizedlist>
176 </para>
177
178
179 <para>
180 "application/postscript" first goes thru the "pstops" filter (where the page counting
181 and accounting takes place). The outcome will be of MIME type
182 "application/vnd.cups-postscript". The pstopsfilter reads and uses information from
183 the PPD and inserts user-provided options into the PostScript file. As a consequence,
184 the filtered file could possibly have an unwanted PJL header.
185 </para>
186
187 <para>
188 "application/postscript" will be all files with a ".ps", ".ai", ".eps" suffix or which
189 have as their first character string one of "%!" or "<04>%".
190 </para>
191
192 <para>
193 "application/vnd.cups-postscript" will files which contain the string
194 "LANGUAGE=POSTSCRIPT" (or similar variations with different capitalization) in the
195 first 512 bytes, and also contain the "PJL super escape code" in the first 128 bytes
196 ("<1B>%-12345X"). Very likely, most PostScript files generated on Windows using a CUPS
197 or other PPD, will have to be auto-typed as "vnd.cups-postscript".  A file produced
198 with a "Generic PostScript driver" will just be tagged "application/postscript".
199 </para>
200
201 <para>
202 Once the file is in "application/vnd.cups-postscript" format, either "pstoraster"
203 or "cupsomatic" will take over (depending on the printer configuration, as
204 determined by the PPD in use).
205 </para>
206
207 <note><para>
208 A printer queue with *no* PPD associated to it is a "raw" printer and all files
209 will go directly there as received by the spooler. The exeptions are file types
210 "application/octet-stream" which need "passthrough feature" enabled.
211 "Raw" queues don't do any filtering at all, they hand the file directly to the
212 CUPS backend. This backend is responsible for the sending of the data to the device
213 (as in the "device URI" notation as lpd://, socket://, smb://, ipp://, http://,
214 parallel:/, serial:/, usb:/ etc.)
215 </para></note>
216
217 <note><para>
218 "cupsomatic"/Foomatic are *not* native CUPS drivers and they don't ship with CUPS.
219 They are a Third Party add-on, developed at Linuxprinting.org.  As such, they are
220 a brilliant hack to make all models (driven by Ghostscript drivers/filters in
221 traditional spoolers) also work via CUPS, with the same (good or bad!) quality
222 as in these other spoolers. "cupsomatic" is only a vehicle to execute a ghostscript
223 commandline at that stage in the CUPS filtering chain, where "normally" the native
224 CUPS "pstoraster" filter would kick in.  cupsomatic by-passes pstoraster, "kidnaps"
225 the printfile from CUPS away and re-directs it to go through Ghostscipt. CUPS accepts this,
226 because the associated CUPS-O-Matic-/Foomatic-PPD specifies:
227 </para>
228
229 <programlisting>
230    *cupsFilter:  "application/vnd.cups-postscript 0 cupsomatic"
231 </programlisting>
232
233 <para>
234 This line persuades CUPS to hand the file to cupsomatic, once it has successfully
235 converted it to the MIME type "application/vnd.cups-postscript". This conversion will not
236 happen for Jobs arriving from Windows which are auto-typed "application/octet-stream",
237 with the according changes in "/etc/cups/mime.types" in place.
238 </para></note>
239
240 <para>
241 CUPS is widely configurable and flexible, even regarding its filtering mechanism.
242 Another workaround in some situations would be to have
243 in "/etc/cups/mime.types" entries as follows:
244 </para>
245
246 <programlisting>
247    application/postscript           application/vnd.cups-raw  0  -
248    application/vnd.cups-postscript  application/vnd.cups-raw  0  -
249 </programlisting>
250
251 <para>
252 This would prevent all Postscript files from being filtered (rather, they will go
253 thru the virtual "nullfilter" denoted with "-"). This could only be useful for
254 PS printers. If you want to print PS code on non-PS printers an entry as follows
255 could be useful:
256 </para>
257
258 <programlisting>
259    */*           application/vnd.cups-raw  0  -
260 </programlisting>
261
262 <para>
263 and would effectively send *all* files to the backend without further processing.
264 </para>
265
266 <para>
267 Lastly, you could have the following entry:
268 </para>
269
270 <programlisting>
271    application/vnd.cups-postscript  application/vnd.cups-raw  0  my_PJL_stripping_filter
272 </programlisting>
273
274 <para>
275 You will need to write a "my_PJL_stripping_filter" (could be a shellscript) that
276 parses the PostScript and removes the unwanted PJL. This would need to conform to
277 CUPS filter design (mainly, receive and pass the parameters printername, job-id,
278 username, jobtitle, copies, print options and possibly the filename). It would
279 be installed as world executable into "/usr/lib/cups/filters/" and will be called
280 by CUPS if it encounters a MIME type "application/vnd.cups-postscript".
281 </para>
282
283 <para>
284 CUPS can handle "-o job-hold-until=indefinite". This keeps the job in the queue
285 "on hold". It will only be printed upon manual release by the printer operator.
286 This is a requirement in many "central reproduction departments", where a few
287 operators manage the jobs of hundreds of users on some big machine, where no
288 user is allowed to have direct access. (The operators often need to load the
289 proper paper type before running the 10.000 page job requested by marketing
290 for the mailing, etc.).
291 </para>
292
293 </sect1>
294
295 <sect1>
296 <title>CUPS as a network PostScript RIP -- CUPS drivers working on server, Adobe
297 PostScript driver with CUPS-PPDs downloaded to clients</title>
298
299
300 <para>
301 CUPS is perfectly able to use PPD files (PostScript
302 Printer Descriptions). PPDs can control all print device options. They
303 are usually provided by the manufacturer -- if you own a PostSript printer,
304 that is. PPD files are always a component of PostScript printer drivers on MS
305 Windows or Apple Mac OS systems. They are ASCII files containing
306 user-selectable print options, mapped to appropriate PostScript, PCL or PJL
307 commands for the target printer. Printer driver GUI dialogs translate these
308 options "on-the-fly" into buttons and drop-down lists for the user to
309 select.
310 </para>
311
312 <para>
313 CUPS can load, without any conversions, the PPD file from
314 any Windows (NT is recommended) PostScript driver and handle the options.
315 There is a web browser interface to the print options (select
316 http://localhost:631/printers/ and click on one "Configure Printer" button
317 to see it), a commandline interface (see <command>man lpoptions</command> or
318 try if you have <command>lphelp</command> on your system) plus some different GUI frontends on Linux
319 UNIX, which can present PPD options to the users. PPD options are normally
320 meant to become evaluated by the PostScript RIP on the real PostScript
321 printer.
322 </para>
323
324 <para>
325 CUPS doesn't stop at "real" PostScript printers in its
326 usage of PPDs. The CUPS developers have extended the PPD concept, to also
327 describe available device and driver options for non-PostScript printers
328 through  CUPS-PPDs.
329 </para>
330
331 <para>
332 This is logical, as CUPS includes a fully featured
333 PostScript interpreter (RIP). This RIP is based on Ghostscript. It can
334 process all received PostScript (and additionally many other file formats)
335 from clients. All CUPS-PPDs geared to non-PostScript printers contain an
336 additional line, starting with the keyword <parameter>*cupsFilter</parameter>.
337 This line
338 tells the CUPS print system which printer-specific filter to use for the
339 interpretation of the accompanying PostScript. Thus CUPS lets all its
340 printers appear as PostScript devices to its clients, because it can act as a
341 PostScript RIP for those printers, processing the received PostScript code
342 into a proper raster print format.
343 </para>
344
345 <para>
346 CUPS-PPDs can also be used on Windows-Clients, on top of a
347 PostScript driver (recommended is the Adobe one).
348 </para>
349
350 <para>
351 This feature enables CUPS to do a few tricks no other
352 spooler can do:
353 </para>
354
355 <itemizedlist>
356   <listitem><para>act as a networked PostScript RIP (Raster Image Processor), handling
357     printfiles from all client platforms in a uniform way;</para></listitem>
358   <listitem><para>act as a central accounting and billing server, as all files are passed
359     through the <command>pstops</command> Filter and are therefor logged in
360     the CUPS <filename>page&lowbar;log</filename>. - <emphasis>NOTE: </emphasis>this
361     can not happen with "raw" print jobs, which always remain unfiltered
362     per definition;</para></listitem>
363   <listitem><para>enable clients to consolidate on a single PostScript driver, even for
364     many different target printers.</para></listitem>
365 </itemizedlist>
366 </sect1>
367
368 <sect1>
369 <title>Windows Terminal Servers (WTS) as CUPS clients</title>
370
371 <para>
372 This setup may be of special interest to people
373 experiencing major problems in WTS environments. WTS need often a multitude
374 of non-PostScript drivers installed to run their clients' variety of
375 different printer models. This often imposes the price of much increased
376 instability. In many cases, in an attempt to overcome this problem, site
377 administrators have resorted to restrict the allowed drivers installed on
378 their WTS to one generic PCL- and one PostScript driver. This however
379 restricts the clients in the amount of printer options available for them --
380 often they can't get out more then simplex prints from one standard paper
381 tray, while their devices could do much better, if driven by a different
382 driver!
383 </para>
384
385 <para>
386 Using an Adobe PostScript driver, enabled with a CUPS-PPD,
387 seems to be a very elegant way to overcome all these shortcomings. The
388 PostScript driver is not known to cause major stability problems on WTS (even
389 if used with many different PPDs). The clients will be able to (again) chose
390 paper trays, duplex printing and other settings. However, there is a certain
391 price for this too: a  CUPS server acting as a PostScript RIP for its clients
392 requires more CPU and RAM than just to act as  a "raw spooling" device. Plus,
393 this setup is not yet widely tested, although the first feedbacks look very
394 promising...
395 </para>
396 </sect1>
397
398
399 <sect1>
400 <title>Setting up CUPS for driver download</title>
401
402 <para>
403 The <command>cupsadsmb</command> utility (shipped with all current
404 CUPS versions) makes the sharing of any (or all) installed CUPS printers very
405 easy. Prior to using it, you need the following settings in smb.conf:
406 </para>
407
408         <para><programlisting>[global]
409                  load printers = yes
410                  printing = cups
411                  printcap name = cups
412
413         [printers]
414                  comment = All Printers
415                  path = /var/spool/samba
416                  browseable = no
417                  public = yes
418                  guest ok = yes
419                  writable = no
420                  printable = yes
421                  printer admin = root
422
423         [print$]
424                  comment = Printer Drivers
425                  path = /etc/samba/drivers
426                  browseable = yes
427                  guest ok = no
428                  read only = yes
429                  write list = root
430         </programlisting></para>
431
432 <para>
433 For licensing reasons the necessary files of the Adobe
434 Postscript driver can not be distributed with either Samba or CUPS. You need
435 to download them yourself from the Adobe website. Once extracted, create a
436 <filename>drivers</filename> directory in the CUPS data directory (usually
437 <filename>/usr/share/cups/</filename>). Copy the Adobe files using
438 UPPERCASE filenames, to this directory as follows:
439 </para>
440
441         <para><programlisting>
442                 ADFONTS.MFM
443                 ADOBEPS4.DRV
444                 ADOBEPS4.HLP
445                 ADOBEPS5.DLL
446                 ADOBEPSU.DLL
447                 ADOBEPSU.HLP
448                 DEFPRTR2.PPD
449                 ICONLIB.DLL
450         </programlisting></para>
451
452 <para>
453 Users of the ESP Print Pro software are able to install
454 their "Samba Drivers" package for this purpose with no problem.
455 </para>
456 </sect1>
457
458
459
460 <sect1>
461 <title>Sources of CUPS drivers / PPDs</title>
462
463 <para>
464 On the internet you can find now many thousand CUPS-PPD
465 files (with their companion filters), in many national languages,
466 supporting more than 1.000 non-PostScript models.
467 </para>
468
469 <itemizedlist>
470   <listitem><para><ulink url="http://wwwl.easysw.com/printpro/">ESP PrintPro
471     (http://wwwl.easysw.com/printpro/)</ulink>
472     (commercial, non-Free) is packaged with more than 3.000 PPDs, ready for
473     successful usage "out of the box" on Linux, IBM-AIX, HP-UX, Sun-Solaris,
474     SGI-IRIX, Compaq Tru64, Digital Unix and some more commercial Unices (it
475     is written by the CUPS developers themselves and its sales help finance
476     the further development of CUPS, as they feed their creators)</para></listitem>
477   <listitem><para>the <ulink
478     url="http://gimp-print.sourceforge.net/">Gimp-Print-Project
479     (http://gimp-print.sourceforge.net/)</ulink>
480     (GPL, Free Software) provides around 120 PPDs (supporting nearly 300
481     printers, many driven to photo quality output), to be used alongside the
482     Gimp-Print CUPS filters;</para></listitem>
483   <listitem><para><ulink url="http://www.turboprint.com/">TurboPrint
484     (http://www.turboprint.com/)</ulink>
485     (Shareware, non-Freee) supports roughly the same amount of printers in
486     excellent quality;</para></listitem>
487   <listitem><para><ulink
488     url="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/">OMNI
489     (http://www-124.ibm.com/developerworks/oss/linux/projects/omni/)</ulink>
490     (LPGL, Free) is a package made by IBM, now containing support for more
491     than 400 printers, stemming from the inheritance of IBM OS/2 KnowHow
492     ported over to Linux (CUPS support is in a Beta-stage at present);</para></listitem>
493   <listitem><para><ulink url="http://hpinkjet.sourceforge.net/">HPIJS
494     (http://hpinkjet.sourceforge.net/)</ulink>
495     (BSD-style licnes, Free) supports around 120 of HP's own printers and is
496     also providing excellent print quality now;</para></listitem>
497   <listitem><para><ulink
498     url="http://www.linuxprinting.org/">Foomatic/cupsomatic (http://www.linuxprinting.org/)</ulink>
499     (LPGL, Free) from Linuxprinting.org are providing PPDs for practically every
500     Ghostscript filter known to the world, now usable with CUPS.</para></listitem>
501 </itemizedlist>
502
503 <para>
504 <emphasis>NOTE: </emphasis>the cupsomatic trick from Linuxprinting.org is
505 working different from the other drivers. While the other drivers take the
506 generic CUPS raster (produced by CUPS' own pstoraster PostScript RIP) as
507 their input, cupsomatic "kidnaps" the PostScript inside CUPS, before
508 RIP-ping, deviates it to an external Ghostscript installation (which now
509 becomes the RIP) and gives it back to a CUPS backend once Ghostscript is
510 finished. -- CUPS versions from 1.1.15 and later will provide their pstoraster
511 PostScript RIP function again inside a system-wide Ghostscript
512 installation rather than in "their own" pstoraster filter. (This
513 CUPS-enabling Ghostscript version may be installed either as a
514 patch to GNU or AFPL Ghostscript, or as a complete ESP Ghostscript package).
515 However, this will not change the cupsomatic approach of guiding the printjob
516 along a different path through the filtering system than the standard CUPS
517 way...
518 </para>
519
520 <para>
521 Once you installed a printer inside CUPS with one of the
522 recommended methods (the lpadmin command, the web browser interface or one of
523 the available GUI wizards), you can use <command>cupsaddsmb</command> to share the
524 printer via Samba. <command>cupsaddsmb</command> prepares the driver files for
525 comfortable client download and installation upon their first contact with
526 this printer share.
527 </para>
528
529
530
531 <sect2>
532 <title><command>cupsaddsmb</command></title>
533
534
535 <para>
536 The <command>cupsaddsmb</command> command copies the needed files
537 for convenient Windows client installations from the previously prepared CUPS
538 data directory to your [print$] share. Additionally, the PPD
539 associated with this printer is copied from <filename>/etc/cups/ppd/</filename> to
540 [print$].
541 </para>
542
543 <para><programlisting>
544 <prompt>root# </prompt> <command>cupsaddsmb -U root infotec_IS2027</command>
545 Password for root required to access localhost via SAMBA: <userinput>[type in password 'secret']</userinput>
546 </programlisting></para>
547
548 <para>
549 To share all printers and drivers, use the <parameter>-a</parameter>
550 parameter instead of a printer name.
551 </para>
552
553
554 <para>
555 Probably you want to see what's going on. Use the
556 <parameter>-v</parameter> parameter to get a more verbose output:
557 </para>
558
559 <para>
560 Probably you want to see what's going on. Use the
561 <parameter>-v</parameter> parameter to get a more verbose output:
562 </para>
563
564 <para><programlisting>
565 Note: The following line shave been wrapped so that information is not lost.
566  
567 <prompt>root# </prompt> cupsaddsmb -v -U root infotec_IS2027
568     Password for root required to access localhost via SAMBA:
569     Running command: smbclient //localhost/print\$ -N -U'root%secret' -c 'mkdir W32X86;put
570        /var/spool/cups/tmp/3cd1cc66376c0 W32X86/infotec_IS2027.PPD;put /usr/share/cups/drivers/
571        ADOBEPS5.DLL W32X86/ADOBEPS5.DLL;put /usr/share/cups/drivers/ADOBEPSU.DLLr
572        W32X86/ADOBEPSU.DLL;put /usr/share/cups/drivers/ADOBEPSU.HLP W32X86/ADOBEPSU.HLP'
573     added interface ip=10.160.16.45 bcast=10.160.31.255 nmask=255.255.240.0
574     added interface ip=192.168.182.1 bcast=192.168.182.255 nmask=255.255.255.0
575     added interface ip=172.16.200.1 bcast=172.16.200.255 nmask=255.255.255.0
576     Domain=[TUX-NET] OS=[Unix] Server=[Samba 2.2.3a.200204262025cvs]
577     NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86
578     putting file /var/spool/cups/tmp/3cd1cc66376c0 as \W32X86/infotec_IS2027.PPD (17394.6 kb/s)
579       (average 17395.2 kb/s)
580     putting file /usr/share/cups/drivers/ADOBEPS5.DLL as \W32X86/ADOBEPS5.DLL (10877.4 kb/s)
581       (average 11343.0 kb/s)
582     putting file /usr/share/cups/drivers/ADOBEPSU.DLL as \W32X86/ADOBEPSU.DLL (5095.2 kb/s)
583       (average 9260.4 kb/s)
584     putting file /usr/share/cups/drivers/ADOBEPSU.HLP as \W32X86/ADOBEPSU.HLP (8828.7 kb/s)
585       (average 9247.1 kb/s)
586
587     Running command: smbclient //localhost/print\$ -N -U'root%secret' -c 'mkdir WIN40;put
588       /var/spool/cups/tmp/3cd1cc66376c0 WIN40/infotec_IS2027.PPD;put
589       /usr/share/cups/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM;put
590       /usr/share/cups/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV;put
591       /usr/share/cups/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP;put
592       /usr/share/cups/drivers/DEFPRTR2.PPD WIN40/DEFPRTR2.PPD;put
593       /usr/share/cups/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL;put
594       /usr/share/cups/drivers/PSMON.DLL WIN40/PSMON.DLL;'
595     added interface ip=10.160.16.45 bcast=10.160.31.255 nmask=255.255.240.0
596     added interface ip=192.168.182.1 bcast=192.168.182.255 nmask=255.255.255.0
597     added interface ip=172.16.200.1 bcast=172.16.200.255 nmask=255.255.255.0
598     Domain=[TUX-NET] OS=[Unix] Server=[Samba 2.2.3a.200204262025cvs]
599     NT_STATUS_OBJECT_NAME_COLLISION making remote directory \WIN40
600     putting file /var/spool/cups/tmp/3cd1cc66376c0 as \WIN40/infotec_IS2027.PPD (26091.5 kb/s)
601       (average 26092.8 kb/s)
602     putting file /usr/share/cups/drivers/ADFONTS.MFM as \WIN40/ADFONTS.MFM (11241.6 kb/s)
603       (average 11812.9 kb/s)
604     putting file /usr/share/cups/drivers/ADOBEPS4.DRV as \WIN40/ADOBEPS4.DRV (16640.6 kb/s)
605       (average 14679.3 kb/s)
606     putting file /usr/share/cups/drivers/ADOBEPS4.HLP as \WIN40/ADOBEPS4.HLP (11285.6 kb/s)
607       (average 14281.5 kb/s)
608     putting file /usr/share/cups/drivers/DEFPRTR2.PPD as \WIN40/DEFPRTR2.PPD (823.5 kb/s)
609       (average 12944.0 kb/s)
610     putting file /usr/share/cups/drivers/ICONLIB.DLL as \WIN40/ICONLIB.DLL (19226.2 kb/s)
611       (average 13169.7 kb/s)
612     putting file /usr/share/cups/drivers/PSMON.DLL as \WIN40/PSMON.DLL (18666.1 kb/s)
613       (average 13266.7 kb/s)
614
615     Running command: rpcclient localhost -N -U'root%secret' -c 'adddriver "Windows NT x86"
616        "infotec_IS2027:ADOBEPS5.DLL:infotec_IS2027.PPD:ADOBEPSU.DLL:ADOBEPSU.HLP:NULL:RAW:NULL"'
617     cmd = adddriver "Windows NT x86" "infotec_IS2027:ADOBEPS5.DLL:infotec_IS2027.PPD:ADOBEPSU.DLL:
618        ADOBEPSU.HLP:NULL:RAW:NULL"
619     Printer Driver infotec_IS2027 successfully installed.
620
621     Running command: rpcclient localhost -N -U'root%secret' -c 'adddriver "Windows 4.0"
622        "infotec_IS2027:ADOBEPS4.DRV:infotec_IS2027.PPD:NULL:ADOBEPS4.HLP:PSMON.DLL:RAW:
623        ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"'
624     cmd = adddriver "Windows 4.0" "infotec_IS2027:ADOBEPS4.DRV:infotec_IS2027.PPD:NULL:
625        ADOBEPS4.HLP:PSMON.DLL:RAW:ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"
626     Printer Driver infotec_IS2027 successfully installed.
627
628     Running command: rpcclient localhost -N -U'root%secret'
629        -c 'setdriver infotec_IS2027 infotec_IS2027'
630     cmd = setdriver infotec_IS2027 infotec_IS2027
631     Succesfully set infotec_IS2027 to driver infotec_IS2027.
632
633     <prompt>root# </prompt>
634 </programlisting></para>
635
636 <para>
637 If you look closely, you'll discover your root password was transfered unencrypted over
638 the wire, so beware! Also, if you look further her, you'll discover error messages like
639 <constant>NT_STATUS_OBJECT_NAME_COLLISION</constant> in between. They occur, because
640 the directories <filename>WIN40</filename> and <filename>W32X86</filename> already
641 existed in the [print$] driver download share (from a previous driver
642 installation). They are harmless here.
643 </para>
644
645 <para>
646 Now your printer is prepared for the clients to use. From
647 a client, browse to the CUPS/Samba server, open the "Printers"
648 share, right-click on this printer and select "Install..." or
649 "Connect..." (depending on the Windows version you use). Now their
650 should be a new printer in your client's local "Printers" folder,
651 named (in my case) "infotec_IS2027 on kdebitshop"
652 </para>
653
654 <para>
655 <emphasis>NOTE: </emphasis>
656 <command>cupsaddsmb</command> will only reliably work i
657 with CUPS version 1.1.15 or higher
658 and Samba from 2.2.4. If it doesn't work, or if the automatic printer
659 driver download to the clients doesn't succeed, you can still manually
660 install the CUPS printer PPD on top of the Adobe PostScript driver on
661 clients and then point the client's printer queue to the Samba printer
662 share for connection, should you desire to use the CUPS networked
663 PostScript RIP functions.
664 </para>
665 </sect2>
666 </sect1>
667
668
669 <sect1>
670 <title>The CUPS Filter Chains</title>
671
672 <para>
673 The following diagrams reveal how CUPS handles print jobs.
674 </para>
675
676 <programlisting>
677 #########################################################################
678 #
679 # CUPS in and of itself has this (general) filter chain (CAPITAL
680 # letters are FILE-FORMATS or MIME types, other are filters (this is
681 # true for pre-1.1.15 of pre-4.3 versions of CUPS and ESP PrintPro):
682 #
683 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
684 #      |
685 #      |
686 #      V
687 #     <replaceable>something</replaceable>tops
688 #      |
689 #      |
690 #      V
691 # APPLICATION/POSTSCRIPT
692 #      |
693 #      |
694 #      V
695 #     pstops
696 #      |
697 #      |
698 #      V
699 # APPLICATION/VND.CUPS-POSTSCRIPT
700 #      |
701 #      |
702 #      V
703 #     pstoraster   # as shipped with CUPS, independent from any Ghostscipt
704 #      |           # installation on the system
705 #      |  (= "postscipt interpreter")
706 #      |
707 #      V
708 # APPLICATION/VND.CUPS-RASTER
709 #      |
710 #      |
711 #      V
712 #     rasterto<replaceable>something</replaceable>  (f.e. Gimp-Print filters may be plugged in here)
713 #      |   (= "raster driver")
714 #      |
715 #      V
716 # SOMETHING-DEVICE-SPECIFIC
717 #      |
718 #      |
719 #      V
720 #     backend
721 #
722 #
723 # ESP PrintPro has some enhanced "rasterto<replaceable>something</replaceable>" filters as compared to
724 # CUPS, and also a somewhat improved "pstoraster" filter.
725 #
726 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
727 #       CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
728 #
729 #########################################################################
730 </programlisting>
731
732 <programlisting>
733 #########################################################################
734 #
735 # This is how "cupsomatic" comes into play:
736 # =========================================
737 #
738 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
739 #      |
740 #      |
741 #      V
742 #    <replaceable>something</replaceable>tops
743 #      |
744 #      |
745 #      V
746 # APPLICATION/POSTSCRIPT
747 #      |
748 #      |
749 #      V
750 #    pstops
751 #      |
752 #      |
753 #      V
754 # APPLICATION/VND.CUPS-POSTSCRIPT ----------------+
755 #      |                                          |
756 #      |                                          V
757 #      V                                         cupsomatic
758 #    pstoraster                                  (constructs complicated
759 #      |  (= "postscipt interpreter")            Ghostscript commandline
760 #      |                                         to let the file be
761 #      V                                         processed by a
762 # APPLICATION/VND.CUPS-RASTER                    "-sDEVICE=<replaceable>s.th.</replaceable>"
763 #      |                                         call...)
764 #      |                                          |
765 #      V                                          |
766 #    rasterto<replaceable>something</replaceable>                          V
767 #      |    (= "raster driver")     +-------------------------+
768 #      |                            | Ghostscript at work.... |
769 #      V                            |                         |
770 # SOMETHING-DEVICE-SPECIFIC         *-------------------------+
771 #      |                                          |
772 #      |                                          |
773 #      V                                          |
774 #    backend &gt;------------------------------------+
775 #      |
776 #      |
777 #      V
778 #    THE PRINTER
779 #
780 #
781 # Note, that cupsomatic "kidnaps" the printfile after the
782 # "APPLICATION/VND.CUPS-POSTSCRPT" stage and deviates it through
783 # the CUPS-external, systemwide Ghostscript installation, bypassing the
784 # "pstoraster" filter (therefor also bypassing the CUPS-raster-drivers
785 # "rasterto<replaceable>something</replaceable>", and hands the rasterized file directly to the CUPS
786 # backend...
787 #
788 # cupsomatic is not made by the CUPS developers. It is an independent
789 # contribution to printing development, made by people from
790 # Linuxprinting.org. (see also http://www.cups.org/cups-help.html)
791 #
792 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
793 #       CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
794 #
795 #########################################################################
796 </programlisting>
797
798 <programlisting>
799 #########################################################################
800 #
801 # And this is how it works for ESP PrintPro from 4.3:
802 # ===================================================
803 #
804 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
805 #      |
806 #      |
807 #      V
808 #     <replaceable>something</replaceable>tops
809 #      |
810 #      |
811 #      V
812 # APPLICATION/POSTSCRIPT
813 #      |
814 #      |
815 #      V
816 #     pstops
817 #      |
818 #      |
819 #      V
820 # APPLICATION/VND.CUPS-POSTSCRIPT
821 #      |
822 #      |
823 #      V
824 #     gsrip
825 #      |  (= "postscipt interpreter")
826 #      |
827 #      V
828 # APPLICATION/VND.CUPS-RASTER
829 #      |
830 #      |
831 #      V
832 #     rasterto<replaceable>something</replaceable>  (f.e. Gimp-Print filters may be plugged in here)
833 #      |   (= "raster driver")
834 #      |
835 #      V
836 # SOMETHING-DEVICE-SPECIFIC
837 #      |
838 #      |
839 #      V
840 #     backend
841 #
842 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
843 #       CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
844 #
845 #########################################################################
846 </programlisting>
847
848 <programlisting>
849 #########################################################################
850 #
851 # This is how "cupsomatic" would come into play with ESP PrintPro:
852 # ================================================================
853 #
854 #
855 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
856 #      |
857 #      |
858 #      V
859 #    <replaceable>something</replaceable>tops
860 #      |
861 #      |
862 #      V
863 # APPLICATION/POSTSCRIPT
864 #      |
865 #      |
866 #      V
867 #    pstops
868 #      |
869 #      |
870 #      V
871 # APPLICATION/VND.CUPS-POSTSCRIPT ----------------+
872 #      |                                          |
873 #      |                                          V
874 #      V                                         cupsomatic
875 #    gsrip                                       (constructs complicated
876 #      |  (= "postscipt interpreter")            Ghostscript commandline
877 #      |                                         to let the file be
878 #      V                                         processed by a
879 # APPLICATION/VND.CUPS-RASTER                    "-sDEVICE=<replaceable>s.th.</replaceable>"
880 #      |                                         call...)
881 #      |                                          |
882 #      V                                          |
883 #    rasterto<replaceable>something</replaceable>                          V
884 #      |   (= "raster driver")      +-------------------------+
885 #      |                            | Ghostscript at work.... |
886 #      V                            |                         |
887 # SOMETHING-DEVICE-SPECIFIC         *-------------------------+
888 #      |                                          |
889 #      |                                          |
890 #      V                                          |
891 #    backend &gt;------------------------------------+
892 #      |
893 #      |
894 #      V
895 #    THE PRINTER
896 #
897 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
898 #       CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
899 #
900 #########################################################################
901 </programlisting>
902
903 <programlisting>
904 #########################################################################
905 #
906 # And this is how it works for CUPS from 1.1.15:
907 # ==============================================
908 #
909 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
910 #      |
911 #      |
912 #      V
913 #     <replaceable>something</replaceable>tops
914 #      |
915 #      |
916 #      V
917 # APPLICATION/POSTSCRIPT
918 #      |
919 #      |
920 #      V
921 #     pstops
922 #      |
923 #      |
924 #      V
925 # APPLICATION/VND.CUPS-POSTSCRIPT-----+
926 #                                     |
927 #                  +------------------v------------------------------+
928 #                  | Ghostscript                                     |
929 #                  | at work...                                      |
930 #                  | (with                                           |
931 #                  | "-sDEVICE=cups")                                |
932 #                  |                                                 |
933 #                  |         (= "postscipt interpreter")             |
934 #                  |                                                 |
935 #                  +------------------v------------------------------+
936 #                                     |
937 #                                     |
938 # APPLICATION/VND.CUPS-RASTER &gt;-------+
939 #      |
940 #      |
941 #      V
942 #     rasterto<replaceable>something</replaceable>
943 #      |   (= "raster driver")
944 #      |
945 #      V
946 # SOMETHING-DEVICE-SPECIFIC
947 #      |
948 #      |
949 #      V
950 #     backend
951 #
952 #
953 # NOTE: since version 1.1.15 CUPS "outsourced" the pstoraster process to
954 #       Ghostscript. GNU Ghostscript needs to be patched to handle the
955 #       CUPS requirement; ESP Ghostscript has this builtin. In any case,
956 #       "gs -h" needs to show up a "cups" device. pstoraster is now a
957 #       calling an appropriate "gs -sDEVICE=cups..." commandline to do
958 #       the job. It will output "application/vnd.cup-raster", which will
959 #       be finally processed by a CUPS raster driver "rasterto<replaceable>something</replaceable>"
960 #       Note the difference to "cupsomatic", which will *not* output
961 #       CUPS-raster, but a final version of the printfile, ready to be
962 #       sent to the printer. cupsomatic also doesn't use the "cups"
963 #       devicemode in Ghostscript, but one of the classical devicemodes....
964 #
965 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
966 #       CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
967 #
968 #########################################################################
969 </programlisting>
970
971 <programlisting>
972 #########################################################################
973 #
974 # And this is how it works for CUPS from 1.1.15, with cupsomatic included:
975 # ========================================================================
976 #
977 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
978 #      |
979 #      |
980 #      V
981 #     <replaceable>something</replaceable>tops
982 #      |
983 #      |
984 #      V
985 # APPLICATION/POSTSCRIPT
986 #      |
987 #      |
988 #      V
989 #     pstops
990 #      |
991 #      |
992 #      V
993 # APPLICATION/VND.CUPS-POSTSCRIPT-----+
994 #                                     |
995 #                  +------------------v------------------------------+
996 #                  | Ghostscript        . Ghostscript at work....    |
997 #                  | at work...         . (with "-sDEVICE=           |
998 #                  | (with              .            <replaceable>s.th.</replaceable>"        |
999 #                  | "-sDEVICE=cups")   .                            |
1000 #                  |                    .                            |
1001 #                  | (CUPS standard)    .      (cupsomatic)          |
1002 #                  |                    .                            |
1003 #                  |          (= "postscript interpreter")           |
1004 #                  |                    .                            |
1005 #                  +------------------v--------------v---------------+
1006 #                                     |              |
1007 #                                     |              |
1008 # APPLICATION/VND.CUPS-RASTER &gt;-------+              |
1009 #      |                                             |
1010 #      |                                             |
1011 #      V                                             |
1012 #     rasterto<replaceable>something</replaceable>                            |
1013 #      |   (= "raster driver")                       |
1014 #      |                                             |
1015 #      V                                             |
1016 # SOMETHING-DEVICE-SPECIFIC &gt;------------------------+
1017 #      |
1018 #      |
1019 #      V
1020 #     backend
1021 #
1022 #
1023 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
1024 #       CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
1025 #
1026 ##########################################################################
1027 </programlisting>
1028
1029 </sect1>
1030
1031
1032 <sect1>
1033 <title>CUPS Print Drivers and Devices</title>
1034
1035 <para>
1036 CUPS ships with good support for HP LaserJet type printers. You can install
1037 the driver as follows:
1038
1039 <itemizedlist>
1040         <listitem><para>
1041         lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -m laserjet.ppd
1042         </para></listitem>
1043 </itemizedlist>
1044
1045 (The "-m" switch will retrieve the "laserjet.ppd" from the standard repository
1046 for not-yet-installed-PPDs, which CUPS typically stores in 
1047 <filename>/usr/share/cups/model</filename>. Alternatively, you may use
1048 "-P /absolute/filesystem/path/to/where/there/is/PPD/your.ppd").
1049 </para>
1050
1051 <sect2>
1052 <title>Further printing steps</title>
1053
1054 <para>
1055 Always also consult the database on linuxprinting.org for all recommendations
1056 about which driver is best used for each printer:
1057 </para>
1058
1059 <para><ulink url="http://www.linuxprinting.org/printer_list.cgi">http://www.linuxprinting.org/printer_list.cgi</ulink></para>
1060
1061 <para>
1062 There select your model and click on "Show". You'll arrive at a page listing
1063 all drivers working with your model. There will always be *one* 
1064 <emphasis>recommended</emphasis> one. Try this one first. In your case
1065 ("HP LaserJet 4 Plus"), you'll arrive here:
1066 </para>
1067
1068 <para><ulink url="http://www.linuxprinting.org/show_printer.cgi?recnum=75104">http://www.linuxprinting.org/show_printer.cgi?recnum=75104</ulink></para>
1069
1070 <para>
1071 The recommended driver is "ljet4". It has a link to the page for the ljet4
1072 driver too:
1073 </para>
1074
1075 <para><ulink url="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4">http://www.linuxprinting.org/show_driver.cgi?driver=ljet4</ulink>
1076
1077 <para>
1078 On the driver's page, you'll find important and detailed info about how to use
1079 that driver within the various available spoolers. You can generate a PPD for
1080 CUPS. The PPD contains all the info about how to use your model and the driver;
1081 this is, once installed, working transparently for the user -- you'll only
1082 need to choose resolution, paper size etc. from the web-based menu or from
1083 the print dialog GUI or from the commandline...
1084 </para>
1085
1086 <para>
1087 On the driver's page, choose to use the "PPD-O-Matic" online PPD generator
1088 program. Select your model and click "Generate PPD file". When you safe the
1089 appearing ASCII text file, don't use "cut'n'past" (as it could possiblly corrupt
1090 line endings and tabs), but use "Save as..." in your browser's menu. Save it
1091 at "/some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd"
1092 </para>
1093
1094 <para>
1095 Then install the printer:
1096 </para>
1097 <para><programlisting>
1098     "lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E \
1099           -P /some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd"
1100 </programlisting></para>
1101
1102 <para>
1103 Note, that for all the "Foomatic-PPDs" from Linuxprinting.org, you also need
1104 a special "CUPS filter" named "cupsomatic". Get the latest version of
1105 "cupsomatic" from:
1106 </para>
1107
1108 <para><ulink url="http://www.linuxprinting.org/cupsomatic">http://www.linuxprinting.org/cupsomatic</ulink></para>
1109
1110 <para>
1111 This needs to be copied to <filename>/usr/lib/cups/filter/cupsomatic</filename>
1112 and be made world executable. This filter is needed to read and act upon the
1113 specially encoded Foomatic comments, embedded in the printfile, which in turn
1114 are used to construct (transparently for you, the user) the complicated
1115 ghostscript command line needed for your printer/driver combo.
1116 </para>
1117
1118 <para>
1119 You can have a look at all the options for the Ghostscript commandline supported
1120 by your printer and the ljet4 driver by going to the section "Execution details",
1121 selecting your model (Laserjet 4 Plus) and clicking on "Show execution details".
1122 This will bring up this web page:
1123 </para>
1124
1125 <para><ulink url="http://www.linuxprinting.org/execution.cgi?driver=ljet4&amp;printer=75104&amp;.submit=Show+execution+details">http://www.linuxprinting.org/execution.cgi?driver=ljet4&amp;printer=75104&amp;.submit=Show+execution+details</ulink></para>
1126
1127 <para>
1128 The ingenious thing is that the database is kept current. If there
1129 is a bug fix and an improvement somewhere in the database, you will
1130 always get the most current and stable and feature-rich driver by following
1131 the steps described above.
1132 </para>
1133
1134 <note><para>
1135 Till Kamppeter from MandrakeSoft is doing an excellent job here that too few
1136 people are aware of. (So if you use it often, please send him a note showing
1137 your appreciation).</para></note>
1138
1139 <para>
1140 The latest and greatest improvement now is support for "custom page sizes"
1141 for all those printers which support it.
1142 </para>
1143
1144 <para>
1145 "cupsomatic" is documented here:
1146 </para>
1147
1148 <para><ulink url="http://www.linuxprinting.org/cups-doc.html">http://www.linuxprinting.org/cups-doc.html</ulink></para>
1149
1150 <para>
1151 More printing tutorial info may be found here:
1152 </para>
1153
1154 <para><ulink url="http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/">http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/</ulink></para>
1155
1156 <para>
1157 Note, that *all* the Foomatic drivers listed on Linuxprinting.org (now
1158 approaching the "all-time high" number of 1.000 for the supported models)
1159 are using a special filtering chain involving Ghostscript, as described
1160 in this document.
1161 </para>
1162
1163 <para>
1164 Summary - You need:
1165 </para>
1166
1167 <para>
1168 <simplelist>
1169
1170         <member>A "foomatic+<replaceable>something</replaceable>" PPD is not enough to print with CUPS (but it is *one* important component)</member>
1171         <member>The "cupsomatic" filter script (Perl) in <filename>/usr/lib/cups/filters/</filename></member>
1172         <member>Perl to make cupsomatic run</member>
1173         <member>Ghostscript (because it is called and controlled by the PPD/cupsomatic combo in a way to fit your printermodel/driver combo.</member>
1174         <member>Ghostscript *must*, depending on the driver/model, contain support for a certain "device" (as shown by "gs -h")</member>
1175 </simplelist>
1176
1177 <para>
1178 In the case of the "hpijs" driver, you need a Ghostscript version, which
1179 has "ijs" amongst its supported devices in "gs -h". In the case of
1180 "hpijs+foomatic", a valid ghostscript commandline would be reading like this:
1181 </para>
1182
1183 <para><programlisting>
1184        gs -q -dBATCH -dPARANOIDSAFER -dQUIET -dNOPAUSE -sDEVICE=ijs       \
1185              -sIjsServer=hpijs<replaceable>PageSize</replaceable> -dDuplex=<replaceable>Duplex</replaceable> <replaceable>Model</replaceable>        \
1186              -r<replaceable>Resolution</replaceable>,PS:MediaPosition=<replaceable>InputSlot</replaceable> -dIjsUseOutputFD \
1187              -sOutputFile=- -
1188 </programlisting></para>
1189
1190 <note><para>
1191 Note, that with CUPS and the "hpijs+foomatic" PPD (plus Perl and cupsomatic)
1192 you don't need to remember this. You can choose the available print options
1193 thru a GUI print command (like "glp" from ESP's commercially supported
1194 PrintPro software, or KDE's "kprinter", or GNOME's "gtklp" or the independent
1195 "xpp") or the CUPS web interface via human-readable drop-down selection
1196 menus.
1197 </para></note>
1198
1199 <para>
1200 If you use "ESP Ghostscript" (also under the GPL, provided by Easy Software
1201 Products, the makers of CUPS, downloadable from
1202 <ulink url="http://www.cups.org/software.html">http://www.cups.org/software.html</ulink>,
1203 co-maintained by the developers of linuxprinting.org), you are guaranteed to
1204 have in use the most uptodate, bug-fixed, enhanced and stable version of a Free
1205 Ghostscript. It contains support for ~300 devices, whereas plain vanilla
1206 GNU Ghostscript 7.05 only has ~200.
1207 </para>
1208
1209 <para>
1210 If you print only one CUPS test page, from the web interface and when you try to
1211 print a windows test page, it acts like the job was never sent:
1212
1213 <simplelist>
1214         <member>Can you print "standard" jobs from the CUPS machine?</member>
1215         <member>Are the jobs from Windows visible in the Web interface on CUPS (http://localhost:631/)?</member>
1216         <member><emphasis>Most important:</emphasis> What kind of printer driver are you using on the Windows clients?</member>
1217 </simplelist>
1218
1219 You can try to get a more detailed debugging info by setting "LogLevel debug" in
1220 <filename>/etc/cups/cupsd.conf</filename>, re-start cupsd and investigate <filename>/var/log/cups/error_log</filename>
1221 for the whereabouts of your Windows-originating printjobs:
1222 </para>
1223
1224 <simplelist>
1225         <member>what does the "auto-typing" line say? which is the "MIME type" CUPS thinks is arriving from the Windows clients?</member>
1226         <member>are there "filter" available for this MIME type?</member>
1227         <member>are there "filter rules" defined in "/etc/cups/mime.convs" for this MIME type?</member>
1228 </simplelist>
1229
1230 </sect1>
1231
1232
1233 <sect1>
1234 <title>Limiting the number of pages users can print</title>
1235
1236 <para>
1237 The feature you want is dependent on the real print subsystem you're using.
1238 Samba's part is always to receive the job files from the clients (filtered
1239 *or* unfiltered) and hand it over to this printing subsystem.
1240 </para>
1241
1242 <para>
1243 Of course one could "hack" things with one's own scripts.
1244 </para>
1245
1246 <para>
1247 But there is CUPS (Common Unix Printing System). CUPS supports "quotas".
1248 Quotas can be based on sizes of jobs or on the number of pages or both,
1249 and are spanning any time period you want.
1250 </para>
1251
1252 <para>
1253 This is an example command how root would set a print quota in CUPS,
1254 assuming an existing printer named "quotaprinter":
1255 </para>
1256
1257 <programlisting>
1258   lpadmin -p quotaprinter -o job-quota-period=604800 -o job-k-limit=1024 \
1259        -o job-page-limit=100
1260 </programlisting>
1261
1262 <para>
1263 This would limit every single user to print 100 pages or 1024 KB of
1264 data (whichever comes first) within the last 604.800 seconds ( = 1 week).
1265 </para>
1266
1267 <para>
1268 For CUPS to count correctly, the printfile needs to pass the CUPS "pstops" filter,
1269 otherwise it uses a "dummy" count of "1". Some printfiles don't pass it
1270 (eg: image files) but then those are mostly 1 page jobs anyway. This also means,
1271 proprietary drivers for the target printer running on the client computers and
1272 CUPS/Samba then spooling these files as "raw" (i.e. leaving them untouched, not
1273 filtering them), will be counted as "1-pagers" too!
1274 </para>
1275
1276 <para>
1277 You need to send PostScript from the clients (i.e. run a PostScript driver there)
1278 for having the chance to get accounting done. If the printer is a non-PostScript model,
1279 you need to let CUPS do the job to convert the file to a print-ready format for the
1280 target printer. This will be working for currently ~1.000 different printer models, see
1281 </para>
1282
1283 <programlisting>
1284      http://www.linuxprinting.org/printer_list.cgi
1285 </programlisting>
1286
1287 <para>
1288 Before CUPS-1.1.16 your only option was to use the Adobe PostScript
1289 Driver on the Windows clients. The output of this driver was not always
1290 passed thru the "pstops" filter on the CUPS/Samba side, and therefor was
1291 not counted correctly (the reason is that it often --- depending on the
1292 "PPD" being used --- did write a "PJL"-header in front of the real
1293 PostScript which made CUPS to skip the pstops and go directy to
1294 the "pstoraster" stage).
1295 </para>
1296
1297 <para>
1298 From CUPS-1.1.16 onward you can use the "CUPS PostScript Driver
1299 for Windows NT/2K/XP clients" (it is tagged in the download area of
1300 http://www.cups.org/ as the "cups-samba-1.1.16.tar.gz" package).
1301 It is *not* working for Win9x/ME clients. But it:
1302 </para>
1303
1304 <simplelist>
1305         <member>it guarantees to not write an PJL-header</member>
1306         <member>it guarantees to still read and support all PJL-options named in the driver PPD with its own means</member>
1307         <member>it guarantees the file going thru the "pstops" filter on the CUPS/Samba server</member>
1308         <member>it guarantees to page-count correctly the printfile</member>
1309 </simplelist>
1310
1311 <para>
1312 You can read more about the setup of this combination in the
1313 manpage for "cupsaddsmb" (only present with CUPS installed, only
1314 current with CUPS 1.1.16).
1315 </para>
1316
1317 <para>
1318 These are the items CUPS logs in the "page_log" for every single *page* of a job:
1319 </para>
1320
1321 <para><simplelist>
1322 <member>Printer name</member>
1323 <member>User name</member>
1324 <member>Job ID</member>
1325 <member>Time of printing</member>
1326 <member>the page number</member>
1327 <member>the number of copies</member>
1328 <member>a billing info string (optional)</member>
1329 </simplelist>
1330 </para>
1331
1332 <para>
1333 Here is an extract of my CUPS server's page_log file to illustrate
1334 the format and included items:
1335 </para>
1336
1337 <para><computeroutput>
1338         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 1 2  #marketing
1339         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 2 2  #marketing
1340         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 3 2  #marketing
1341         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 4 2  #marketing
1342         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 5 2  #marketing
1343         infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 6 2  #marketing
1344 </computeroutput></para>
1345
1346 <para>
1347 This was Job ID "40", printed on "infotec_IS2027" by user "kurt", a 6-page job
1348 printed in 2 copies and billed to "#marketing"...
1349 </para>
1350
1351 <para>
1352 What flaws or shortcomings are there?
1353 </para>
1354
1355 <simplelist>
1356         <member>the ones named above</member>
1357
1358         <member>
1359         CUPS really counts the job pages being *processsed in software*
1360         (going thru the "RIP") rather than the physical sheets successfully
1361         leaving the printing device -- if there is a jam while printing
1362         the 5th sheet out of 1000 and the job is aborted by the printer,
1363         the "page count" will still show the figure of 1000 for that job
1364         </member>
1365
1366         <member>
1367         all quotas are the same for all users (no flexibility to give the
1368         boss a higher quota than the clerk) no support for groups
1369         </member>
1370
1371         <member>
1372         no means to read out the current balance or "used-up" number of current quota
1373         </member>
1374
1375         <member>
1376         a user having used up 99 sheets of 100 quota will still be able to send and print a 1.000 sheet job
1377         </member>
1378
1379         <member>
1380         a user being denied a job because of a filled-up quota doesn't get a meaningful
1381         error message from CUPS other than "client-error-not-possible".
1382         </member>
1383 </simplelist>
1384
1385 <para>
1386 But this is the best system out there currently. And there are
1387 huge improvements under development:
1388 </para>
1389
1390 <simplelist>
1391         <member>page counting will go into the "backends" (these talk
1392         directly to the printer and will increase the count in sync with the
1393          actual printing process -- a jam at the 5th sheet will lead to a stop in the counting)</member>
1394
1395         <member>quotas will be handled more flexibly</member>
1396
1397         <member>probably there will be support for users to inquire their "accounts" in advance</member>
1398
1399         <member>probably there will be support for some other tools around this topic</member>
1400 </simplelist>
1401
1402 <para>
1403 Other than the current stage of the CUPS development, I don't
1404 know any other ready-to-use tool which you could consider.
1405 </para>
1406
1407 <para>
1408 You can download the driver files from
1409 <ulink url="http://www.cups.org/software.html">http://www.cups.org/software.html</ulink>.
1410 It is a separate package from the CUPS base software files, tagged as "CUPS 1.1.16
1411 Windows NT/2k/XP Printer Driver for SAMBA (tar.gz, 192k)". The filename to
1412 download is "cups-samba-1.1.16.tar.gz". Upon untar-/unzip-ping it will reveal
1413 the files:
1414 </para>
1415
1416         <para>
1417         <computeroutput>
1418            cups-samba.install
1419            cups-samba.license
1420            cups-samba.readme
1421            cups-samba.remove
1422            cups-samba.ss
1423         </computeroutput>
1424         </para>
1425
1426 <para>
1427 These have been packaged with the ESP meta packager software "EPM". The
1428 *.install and *.remove files are simple shell script, which untars the
1429 *.ss (which is nothing else than a tar-archive) and puts its contents
1430 into <filename>/usr/share/cups/drivers/</filename>. Its contents are 3 files:
1431 </para>
1432
1433         <para>
1434         <computeroutput>
1435            cupsdrvr.dll
1436            cupsui.dll
1437            cups.hlp
1438         </computeroutput>
1439         </para>
1440
1441 <caution><para>
1442 Due to a bug one CUPS release puts the <filename>cups.hlp</filename>
1443 into <filename>/usr/share/drivers/</filename> instead of
1444 <filename>/usr/share/cups/drivers/</filename>. To work around this, copy/move
1445 the file after running the "./cups-samba.install" script manually to the right place:
1446 </para>
1447
1448         <para>
1449         <userinput> cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/
1450         </userinput>
1451         </para></caution>
1452
1453 <note>
1454 <para>
1455 This new CUPS PostScript driver is currently binary-only, but free
1456 no source code is provided (yet). The reason is this: it has
1457 been developed with the help of the Microsoft Driver Developer Kit (DDK)
1458 and compiled with Microsoft Visual Studio 6. It is not clear to the driver
1459 developers if they are allowed to distribute the whole of the source code
1460 as Free Software. However, they will likely release the "diff" in source
1461 code under the GPL, so anybody with a license of Visual Studio and a DDK
1462 will be able to compile for him/herself.
1463 </para>
1464
1465 <para>
1466 Once you have run the install script (and possibly manually moved the
1467 "cups.hlp" file to "/usr/share/cups/drivers/"), the driver is ready to be
1468 put into Samba's [print$] share (which often maps to "/etc/samba/drivers/"
1469 and contains a subdir tree with WIN40 and W32X86 branches), by running
1470 "cupsaddsmb" (see also "man cupsaddsmb" for CUPS 1.1.16). [Don't forget to
1471 put root into the smbpasswd file by running "smbpasswd" should you run
1472 this whole procedure for the first time.] Once the driver files are in the
1473 [print$] share, they are ready to be downloaded and installed by the
1474 Win NT/2k/XP clients.
1475 </para></note>
1476
1477
1478         <note><para>
1479         Win 9x/ME clients won't work with this driver. For these you'd
1480         still need to use the ADOBE*.* drivers as previously.
1481         </para></note>
1482
1483         <note><para>
1484         It is not harming if you've still the ADOBE*.* driver files from
1485         previous installations in the "/usr/share/cups/drivers/" directory.
1486         The new cupsaddsmb (from 1.1.16) will automatically use the
1487         "newest" installed driver (which here then is the CUPS drivers).
1488         </para></note>
1489
1490         <note><para>
1491         Should your Win clients have had the old ADOBE*.* files and the
1492         Adobe PostScript drivers installed, the download and installation
1493         of the new CUPS PostScript driver for Windows NT/2k/XP will fail
1494         at first.
1495         </para>
1496         <para>
1497         It is not enough to "delete" the printer (as the driver files
1498         will still be kept by the clients and re-used if you try to
1499         re-install the printer). To really get rid of the Adobe driver
1500         files on the clients, open the "Printers" folder (possibly via
1501         "Start --> Settings --> Control Panel --> Printers"), right-click
1502         onto the folder background and select "Server Properties". A
1503         new dialog opens; select the "Drivers" tab; on the list select
1504         the driver you want to delete and click on the "Delete" button.
1505         (This will only work if there is no single printer left which
1506         uses that particular driver -- you need to "delete" all printers
1507         using this driver in the "Printers" folder first.)
1508         </para>
1509         </note>
1510
1511         <note><para>
1512         Once you have successfully downloaded the CUPS PostScript driver
1513         to a client, you can easily switch all printers to this one
1514         by proceeding as described elsewhere in the "Samba HOWTO
1515         Collection" to change a driver for an existing printer.
1516         </para></note>
1517
1518 <para>
1519 What are the benefits with the "CUPS PostScript driver for Windows NT/2k/XP"
1520 as compared to the Adobe drivers?
1521 </para>
1522        
1523 <para>
1524 <itemizedlist>
1525         <listitem><para>
1526         no hassle with the Adobe EULA
1527         </para></listitem>
1528
1529         <listitem><para>
1530         no hassle with the question "where do I get the ADOBE*.* driver files from?"
1531         </para></listitem>
1532
1533         <listitem><para>
1534         the Adobe drivers (depending on the printer PPD associated with them)
1535         often put a PJL header in front of the core PostScript part of the print
1536         file (thus the file starts with "<replaceable>1B</replaceable>%-12345X" or "<replaceable>escape</replaceable>%-12345X"
1537         instead of "%!PS"). This leads to the CUPS daemon autotyping the
1538         arriving file as a print-ready file, not requiring a pass thru the
1539         "pstops" filter (to speak more technical, it is not regarded as the
1540         generic MIME type "application/postscript", but as the more special
1541         MIME type "application/cups.vnd-postscript"), which therefore also
1542         leads to the page accounting in "/var/log/cups/page_log" not receiving
1543         the exact mumber of pages; instead the dummy page number of "1" is
1544         logged in a standard setup)
1545         </para></listitem>
1546
1547         <listitem><para>
1548         the Adobe driver has more options to "mis-configure" the PostScript
1549         generated by it (like setting it inadvertedly to "Optimize for Speed",
1550         instead of "Optimize for Portability", which could lead to CUPS being
1551         unable to process it)
1552         </para></listitem>
1553
1554         <listitem><para>
1555         the CUPS PostScript driver output sent by Windows clients to the CUPS
1556         server will be guaranteed to be auto-typed as generic MIME type
1557         "application/postscript", thusly passing thru the CUPS "pstops" filter
1558         and logging the correct number of pages in the page_log for accounting
1559         and quota purposes
1560         </para></listitem>
1561
1562         <listitem><para>
1563         the CUPS PostScript driver supports the sending of additional print
1564         options by the Win NT/2k/XP clients, such as naming the CUPS standard
1565         banner pages (or the custom ones, should they be installed at the time
1566         of driver download), using the CUPS "page-label" option, setting a
1567         job-priority and setting the scheduled time of printing (with the option
1568         to support additional useful IPP job attributes in the future).
1569         </para></listitem>
1570
1571         <listitem><para>
1572         the CUPS PostScript driver supports the inclusion of the new
1573         "*cupsJobTicket" comments at the beginnig of the PostScript file (which
1574         could be used in the future for all sort of beneficial extensions on
1575         the CUPS side, but which will not disturb any other application as those
1576         will regard it as a comment and simply ignore it).
1577         </para></listitem>
1578
1579         <listitem><para>
1580         the CUPS PostScript driver will be the heart of the fully fledged CUPS
1581         IPP client for Windows NT/2k/XP to be released soon (probably alongside
1582         the first Beta release for CUPS 1.2).
1583         </para></listitem>
1584
1585 </itemizedlist>
1586 </para>
1587 </sect1>
1588
1589 <sect1>
1590 <title>Advanced Postscript Printing from MS Windows</title>
1591
1592 <para>
1593 Let the Windows Clients use a PostScript driver to deliver poistscript to
1594 the samba print server (just like any Linux or Unix Client would also use
1595 PostScript to send to the server)
1596 </para>
1597
1598 <para>
1599 Make the Unix printing subsystem to which Samba sends the job convert the
1600 incoming PostScript files to the native print format of the target printers
1601 (would be PCL if you have an HP printer)
1602 </para>
1603
1604 <para>
1605 Now if you are afraid that this would just mean using a *Generic* PostScript
1606 driver for the clients that has no Simplex/Duplex selection, and no paper tray
1607 choice, but you need them to be able to set up print jobs, with all the bells
1608 and whistles of your printers:-
1609 </para>
1610
1611 <simplelist>
1612         <member>Not possible with traditional spooling systems</member>
1613
1614         <member>
1615         But perfectly supported by CUPS (which uses "PPD" files to
1616         describe how to control the print options for PostScript and
1617         non-PostScript devices alike...
1618         </member>
1619 </simplelist>
1620
1621 <para>
1622 CUPS PPDs are working perfectly on Windows clients who use Adobe PostScript
1623 drivers (or the new CUPS PostScript driver for Windows NT/2K/XP). Clients can use
1624 them to setup the job to their liking and CUPS will use the received job options
1625 to make the (PCL-, ESC/P- or PostScript-) printer behave as required.
1626 </para>
1627
1628 <para>
1629 If you want to have the additional benefit of page count logging and accounting
1630 then the CUPS PostScript driver is the best choice (better than the Adobe one).
1631 </para>
1632
1633 <para>
1634 If you want to make the drivers downloadable for the clients then "cupsaddsmb" is
1635 your friend. It will setup the [print$] share on the Samba host to be ready to serve
1636 the clients for a "point and print" driver installation.
1637 </para>
1638
1639 <warning>
1640 <para>What strings are attached?</para></warning>
1641
1642 <para>
1643 There are some. But, given the sheer CPU power you can buy nowadays,
1644 these can be overcome easily. The strings:
1645 </para>
1646
1647 <para>
1648 Well, if the CUPS/Samba side will have to print to many printers serving many users,
1649 you probably will need to set up a second server (which can do automatic load balancing
1650 with the first one, plus a degree of fail-over mechanism). Converting the incoming
1651 PostScript jobs, "interpreting" them for non-PostScript printers, amounts to the work
1652 of a "RIP" (Raster Image Processor) done in software. This requires more CPU and RAM
1653 than for the mere "raw spooling" task your current setup is solving. It all depends
1654 on the avarage and peak printing load the server should be able to handle.
1655 </para>
1656
1657 </sect1>
1658
1659 <sect1>
1660 <title>Auto-Deletion of CUPS spool files</title>
1661
1662 <para>
1663 Samba print files pass thru two "spool" directories. One the incoming directory
1664 managed by Samba, (set eg: in the "path = /var/spool/samba" directive in the [printers]
1665 section of "smb.conf"). Second is the spool directory of your UNIX print subsystem.
1666 For CUPS it is normally "/var/spool/cups/", as set by the cupsd.conf directive
1667 "RequestRoot /var/spool/cups".
1668 </para>
1669
1670 <para>
1671 I am not sure, which one of your directories keeps the files.  From what you say,
1672 it is most likely the Samba part.
1673 </para>
1674
1675 <para>
1676 For the CUPS part, you may want to consult:
1677 </para>
1678
1679 <simplelist>
1680 <member>http://localhost:631/sam.html#PreserveJobFiles</member>
1681 <member>http://localhost:631/sam.html#PreserveJobHistory</member>
1682 <member>http://localhost:631/sam.html#MaxJobs</member>
1683 </simplelist>
1684
1685 <para>
1686 There are the settings described for your CUPS daemon, which could lead to completed
1687 job files not being deleted.
1688 </para>
1689
1690 <para>
1691 "PreserveJobHistory Yes" -- keeps some details of jobs in
1692 cupsd's mind (well it keeps the "c12345", "c12346" etc. files
1693 in the CUPS spool directory, which do a similar job as the
1694 old-fashioned BSD-LPD control files). This is set to "Yes"
1695 as a default.
1696 </para>
1697
1698 <para>
1699 "PreserveJobFiles Yes" -- keeps the job files themselves in
1700 cupsd's mind (well it keeps the "d12345", "d12346" etc. files
1701 in the CUPS spool directory...). This is set to "No" as the
1702 CUPS default.
1703 </para>
1704
1705 <para>
1706 "MaxJobs 500" -- this directive controls the maximum number
1707 of jobs that are kept in memory. Once the number of jobs
1708 reaches the limit, the oldest completed job is automatically
1709 purged from the system to make room for the new one. If all
1710 of the known jobs are still pending or active then the new
1711 job will be rejected. Setting the maximum to 0 disables this
1712 functionality. The default setting is 0.
1713 </para>
1714
1715 <para>
1716 (There are also additional settings for "MaxJobsPerUser" and
1717 "MaxJobsPerPrinter"...)
1718 </para>
1719
1720 <para>
1721 For everything to work as announced, you need to have three things:
1722 </para>
1723
1724 <simplelist>
1725
1726         <member>
1727         a Samba-smbd which is compiled against "libcups" (Check on Linux by running "ldd `which smbd`")
1728         </member>
1729
1730         <member>
1731         a Samba-smb.conf setting of "printing = cups"
1732         </member>
1733
1734         <member>
1735         another Samba-smb.conf setting of "printcap = cups"
1736         </member>
1737
1738 </simplelist>
1739
1740 <note><para>
1741 Note, that in this case all other manually set printing-related
1742 commands (like "print command", "lpq command", "lprm command",
1743 "lppause command" or "lpresume command") are ignored and they
1744 should normally have no influence what-so-ever on your printing.
1745 </para></note>
1746
1747 <para>
1748 If you want to do things manually, replace the "printing = cups"
1749 by "printing = bsd". Then your manually set commands may work
1750 (haven't tested this), and a "print command = lp -d %P %s; rm %s"
1751 may do what you need.
1752 </para>
1753
1754 <para>
1755 You forgot to mention the CUPS version you're using. If you did
1756 set things up as described in the man pages, then the Samba
1757 spool files should be deleted. Otherwise it may be a bug. On
1758 the CUPS side, you can control the behaviour as described
1759 above.
1760 </para>
1761
1762 <para>
1763 If you have more problems, post the output of these commands:
1764 </para>
1765
1766 <para>
1767 <userinput>
1768    grep -v ^# /etc/cups/cupsd.conf | grep -v ^$
1769    grep -v ^# /etc/samba/smb.conf | grep -v ^$ | grep -v "^;"
1770 </userinput>
1771 </para>
1772
1773 <para>
1774 (adapt paths as needed). These commands sanitize the files
1775 and cut out the empty lines and lines with comments, providing
1776 the "naked settings" in a compact way.
1777 </para>
1778 </sect1>
1779 </chapter>