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