Use more stricter syntax and work towards Docbook XML migration
[Samba/gebeck_regimport.git] / docs / docbook / projdoc / CUPS-printing.sgml
blobea10ba0e752fe59719ccf88e8534cdddd337caea
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 -- CUPS drivers working on server, Adobe
298 PostScript driver with CUPS-PPDs downloaded to clients</title>
301 <para>
302 CUPS is perfectly able to use PPD files (PostScript
303 Printer Descriptions). PPDs can control all print device options. They
304 are usually provided by the manufacturer -- if you own a PostSript printer,
305 that is. PPD files are always a component of PostScript printer drivers on MS
306 Windows or Apple Mac OS systems. They are ASCII files containing
307 user-selectable print options, mapped to appropriate PostScript, PCL or PJL
308 commands for the target printer. Printer driver GUI dialogs translate these
309 options "on-the-fly" into buttons and drop-down lists for the user to
310 select.
311 </para>
313 <para>
314 CUPS can load, without any conversions, the PPD file from
315 any Windows (NT is recommended) PostScript driver and handle the options.
316 There is a web browser interface to the print options (select
317 http://localhost:631/printers/ and click on one "Configure Printer" button
318 to see it), a commandline interface (see <command>man lpoptions</command> or
319 try if you have <command>lphelp</command> on your system) plus some different GUI frontends on Linux
320 UNIX, which can present PPD options to the users. PPD options are normally
321 meant to become evaluated by the PostScript RIP on the real PostScript
322 printer.
323 </para>
325 <para>
326 CUPS doesn't stop at "real" PostScript printers in its
327 usage of PPDs. The CUPS developers have extended the PPD concept, to also
328 describe available device and driver options for non-PostScript printers
329 through CUPS-PPDs.
330 </para>
332 <para>
333 This is logical, as CUPS includes a fully featured
334 PostScript interpreter (RIP). This RIP is based on Ghostscript. It can
335 process all received PostScript (and additionally many other file formats)
336 from clients. All CUPS-PPDs geared to non-PostScript printers contain an
337 additional line, starting with the keyword <parameter>*cupsFilter</parameter>.
338 This line
339 tells the CUPS print system which printer-specific filter to use for the
340 interpretation of the accompanying PostScript. Thus CUPS lets all its
341 printers appear as PostScript devices to its clients, because it can act as a
342 PostScript RIP for those printers, processing the received PostScript code
343 into a proper raster print format.
344 </para>
346 <para>
347 CUPS-PPDs can also be used on Windows-Clients, on top of a
348 PostScript driver (recommended is the Adobe one).
349 </para>
351 <para>
352 This feature enables CUPS to do a few tricks no other
353 spooler can do:
354 </para>
356 <itemizedlist>
357 <listitem><para>act as a networked PostScript RIP (Raster Image Processor), handling
358 printfiles from all client platforms in a uniform way;</para></listitem>
359 <listitem><para>act as a central accounting and billing server, as all files are passed
360 through the <command>pstops</command> Filter and are therefor logged in
361 the CUPS <filename>page&lowbar;log</filename>. - <emphasis>NOTE: </emphasis>this
362 can not happen with "raw" print jobs, which always remain unfiltered
363 per definition;</para></listitem>
364 <listitem><para>enable clients to consolidate on a single PostScript driver, even for
365 many different target printers.</para></listitem>
366 </itemizedlist>
367 </sect1>
369 <sect1>
370 <title>Windows Terminal Servers (WTS) as CUPS clients</title>
372 <para>
373 This setup may be of special interest to people
374 experiencing major problems in WTS environments. WTS need often a multitude
375 of non-PostScript drivers installed to run their clients' variety of
376 different printer models. This often imposes the price of much increased
377 instability. In many cases, in an attempt to overcome this problem, site
378 administrators have resorted to restrict the allowed drivers installed on
379 their WTS to one generic PCL- and one PostScript driver. This however
380 restricts the clients in the amount of printer options available for them --
381 often they can't get out more then simplex prints from one standard paper
382 tray, while their devices could do much better, if driven by a different
383 driver!
384 </para>
386 <para>
387 Using an Adobe PostScript driver, enabled with a CUPS-PPD,
388 seems to be a very elegant way to overcome all these shortcomings. The
389 PostScript driver is not known to cause major stability problems on WTS (even
390 if used with many different PPDs). The clients will be able to (again) chose
391 paper trays, duplex printing and other settings. However, there is a certain
392 price for this too: a CUPS server acting as a PostScript RIP for its clients
393 requires more CPU and RAM than just to act as a "raw spooling" device. Plus,
394 this setup is not yet widely tested, although the first feedbacks look very
395 promising...
396 </para>
397 </sect1>
400 <sect1>
401 <title>Setting up CUPS for driver download</title>
403 <para>
404 The <command>cupsadsmb</command> utility (shipped with all current
405 CUPS versions) makes the sharing of any (or all) installed CUPS printers very
406 easy. Prior to using it, you need the following settings in &smb.conf;:
407 </para>
409 <para><programlisting>[global]
410 load printers = yes
411 printing = cups
412 printcap name = cups
414 [printers]
415 comment = All Printers
416 path = /var/spool/samba
417 browseable = no
418 public = yes
419 guest ok = yes
420 writable = no
421 printable = yes
422 printer admin = root
424 [print$]
425 comment = Printer Drivers
426 path = /etc/samba/drivers
427 browseable = yes
428 guest ok = no
429 read only = yes
430 write list = root
431 </programlisting></para>
433 <para>
434 For licensing reasons the necessary files of the Adobe
435 Postscript driver can not be distributed with either Samba or CUPS. You need
436 to download them yourself from the Adobe website. Once extracted, create a
437 <filename>drivers</filename> directory in the CUPS data directory (usually
438 <filename>/usr/share/cups/</filename>). Copy the Adobe files using
439 UPPERCASE filenames, to this directory as follows:
440 </para>
442 <para><programlisting>
443 ADFONTS.MFM
444 ADOBEPS4.DRV
445 ADOBEPS4.HLP
446 ADOBEPS5.DLL
447 ADOBEPSU.DLL
448 ADOBEPSU.HLP
449 DEFPRTR2.PPD
450 ICONLIB.DLL
451 </programlisting></para>
453 <para>
454 Users of the ESP Print Pro software are able to install
455 their "Samba Drivers" package for this purpose with no problem.
456 </para>
457 </sect1>
461 <sect1>
462 <title>Sources of CUPS drivers / PPDs</title>
464 <para>
465 On the internet you can find now many thousand CUPS-PPD
466 files (with their companion filters), in many national languages,
467 supporting more than 1.000 non-PostScript models.
468 </para>
470 <itemizedlist>
471 <listitem><para><ulink url="http://wwwl.easysw.com/printpro/">ESP PrintPro
472 (http://wwwl.easysw.com/printpro/)</ulink>
473 (commercial, non-Free) is packaged with more than 3.000 PPDs, ready for
474 successful usage "out of the box" on Linux, IBM-AIX, HP-UX, Sun-Solaris,
475 SGI-IRIX, Compaq Tru64, Digital Unix and some more commercial Unices (it
476 is written by the CUPS developers themselves and its sales help finance
477 the further development of CUPS, as they feed their creators)</para></listitem>
478 <listitem><para>the <ulink
479 url="http://gimp-print.sourceforge.net/">Gimp-Print-Project
480 (http://gimp-print.sourceforge.net/)</ulink>
481 (GPL, Free Software) provides around 120 PPDs (supporting nearly 300
482 printers, many driven to photo quality output), to be used alongside the
483 Gimp-Print CUPS filters;</para></listitem>
484 <listitem><para><ulink url="http://www.turboprint.com/">TurboPrint
485 (http://www.turboprint.com/)</ulink>
486 (Shareware, non-Freee) supports roughly the same amount of printers in
487 excellent quality;</para></listitem>
488 <listitem><para><ulink
489 url="http://www-124.ibm.com/developerworks/oss/linux/projects/omni/">OMNI
490 (http://www-124.ibm.com/developerworks/oss/linux/projects/omni/)</ulink>
491 (LPGL, Free) is a package made by IBM, now containing support for more
492 than 400 printers, stemming from the inheritance of IBM OS/2 KnowHow
493 ported over to Linux (CUPS support is in a Beta-stage at present);</para></listitem>
494 <listitem><para><ulink url="http://hpinkjet.sourceforge.net/">HPIJS
495 (http://hpinkjet.sourceforge.net/)</ulink>
496 (BSD-style licnes, Free) supports around 120 of HP's own printers and is
497 also providing excellent print quality now;</para></listitem>
498 <listitem><para><ulink
499 url="http://www.linuxprinting.org/">Foomatic/cupsomatic (http://www.linuxprinting.org/)</ulink>
500 (LPGL, Free) from Linuxprinting.org are providing PPDs for practically every
501 Ghostscript filter known to the world, now usable with CUPS.</para></listitem>
502 </itemizedlist>
504 <para>
505 <emphasis>NOTE: </emphasis>the cupsomatic trick from Linuxprinting.org is
506 working different from the other drivers. While the other drivers take the
507 generic CUPS raster (produced by CUPS' own pstoraster PostScript RIP) as
508 their input, cupsomatic "kidnaps" the PostScript inside CUPS, before
509 RIP-ping, deviates it to an external Ghostscript installation (which now
510 becomes the RIP) and gives it back to a CUPS backend once Ghostscript is
511 finished. -- CUPS versions from 1.1.15 and later will provide their pstoraster
512 PostScript RIP function again inside a system-wide Ghostscript
513 installation rather than in "their own" pstoraster filter. (This
514 CUPS-enabling Ghostscript version may be installed either as a
515 patch to GNU or AFPL Ghostscript, or as a complete ESP Ghostscript package).
516 However, this will not change the cupsomatic approach of guiding the printjob
517 along a different path through the filtering system than the standard CUPS
518 way...
519 </para>
521 <para>
522 Once you installed a printer inside CUPS with one of the
523 recommended methods (the lpadmin command, the web browser interface or one of
524 the available GUI wizards), you can use <command>cupsaddsmb</command> to share the
525 printer via Samba. <command>cupsaddsmb</command> prepares the driver files for
526 comfortable client download and installation upon their first contact with
527 this printer share.
528 </para>
532 <sect2>
533 <title><command>cupsaddsmb</command></title>
536 <para>
537 The <command>cupsaddsmb</command> command copies the needed files
538 for convenient Windows client installations from the previously prepared CUPS
539 data directory to your [print$] share. Additionally, the PPD
540 associated with this printer is copied from <filename>/etc/cups/ppd/</filename> to
541 [print$].
542 </para>
544 <para><programlisting>
545 <prompt>root# </prompt> <command>cupsaddsmb -U root infotec_IS2027</command>
546 Password for root required to access localhost via SAMBA: <userinput>[type in password 'secret']</userinput>
547 </programlisting></para>
549 <para>
550 To share all printers and drivers, use the <parameter>-a</parameter>
551 parameter instead of a printer name.
552 </para>
555 <para>
556 Probably you want to see what's going on. Use the
557 <parameter>-v</parameter> parameter to get a more verbose output:
558 </para>
560 <para>
561 Probably you want to see what's going on. Use the
562 <parameter>-v</parameter> parameter to get a more verbose output:
563 </para>
565 <para><programlisting>
566 Note: The following line shave been wrapped so that information is not lost.
568 <prompt>root# </prompt> cupsaddsmb -v -U root infotec_IS2027
569 Password for root required to access localhost via SAMBA:
570 Running command: smbclient //localhost/print\$ -N -U'root%secret' -c 'mkdir W32X86;put
571 /var/spool/cups/tmp/3cd1cc66376c0 W32X86/infotec_IS2027.PPD;put /usr/share/cups/drivers/
572 ADOBEPS5.DLL W32X86/ADOBEPS5.DLL;put /usr/share/cups/drivers/ADOBEPSU.DLLr
573 W32X86/ADOBEPSU.DLL;put /usr/share/cups/drivers/ADOBEPSU.HLP W32X86/ADOBEPSU.HLP'
574 added interface ip=10.160.16.45 bcast=10.160.31.255 nmask=255.255.240.0
575 added interface ip=192.168.182.1 bcast=192.168.182.255 nmask=255.255.255.0
576 added interface ip=172.16.200.1 bcast=172.16.200.255 nmask=255.255.255.0
577 Domain=[TUX-NET] OS=[Unix] Server=[Samba 2.2.3a.200204262025cvs]
578 NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86
579 putting file /var/spool/cups/tmp/3cd1cc66376c0 as \W32X86/infotec_IS2027.PPD (17394.6 kb/s)
580 (average 17395.2 kb/s)
581 putting file /usr/share/cups/drivers/ADOBEPS5.DLL as \W32X86/ADOBEPS5.DLL (10877.4 kb/s)
582 (average 11343.0 kb/s)
583 putting file /usr/share/cups/drivers/ADOBEPSU.DLL as \W32X86/ADOBEPSU.DLL (5095.2 kb/s)
584 (average 9260.4 kb/s)
585 putting file /usr/share/cups/drivers/ADOBEPSU.HLP as \W32X86/ADOBEPSU.HLP (8828.7 kb/s)
586 (average 9247.1 kb/s)
588 Running command: smbclient //localhost/print\$ -N -U'root%secret' -c 'mkdir WIN40;put
589 /var/spool/cups/tmp/3cd1cc66376c0 WIN40/infotec_IS2027.PPD;put
590 /usr/share/cups/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM;put
591 /usr/share/cups/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV;put
592 /usr/share/cups/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP;put
593 /usr/share/cups/drivers/DEFPRTR2.PPD WIN40/DEFPRTR2.PPD;put
594 /usr/share/cups/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL;put
595 /usr/share/cups/drivers/PSMON.DLL WIN40/PSMON.DLL;'
596 added interface ip=10.160.16.45 bcast=10.160.31.255 nmask=255.255.240.0
597 added interface ip=192.168.182.1 bcast=192.168.182.255 nmask=255.255.255.0
598 added interface ip=172.16.200.1 bcast=172.16.200.255 nmask=255.255.255.0
599 Domain=[TUX-NET] OS=[Unix] Server=[Samba 2.2.3a.200204262025cvs]
600 NT_STATUS_OBJECT_NAME_COLLISION making remote directory \WIN40
601 putting file /var/spool/cups/tmp/3cd1cc66376c0 as \WIN40/infotec_IS2027.PPD (26091.5 kb/s)
602 (average 26092.8 kb/s)
603 putting file /usr/share/cups/drivers/ADFONTS.MFM as \WIN40/ADFONTS.MFM (11241.6 kb/s)
604 (average 11812.9 kb/s)
605 putting file /usr/share/cups/drivers/ADOBEPS4.DRV as \WIN40/ADOBEPS4.DRV (16640.6 kb/s)
606 (average 14679.3 kb/s)
607 putting file /usr/share/cups/drivers/ADOBEPS4.HLP as \WIN40/ADOBEPS4.HLP (11285.6 kb/s)
608 (average 14281.5 kb/s)
609 putting file /usr/share/cups/drivers/DEFPRTR2.PPD as \WIN40/DEFPRTR2.PPD (823.5 kb/s)
610 (average 12944.0 kb/s)
611 putting file /usr/share/cups/drivers/ICONLIB.DLL as \WIN40/ICONLIB.DLL (19226.2 kb/s)
612 (average 13169.7 kb/s)
613 putting file /usr/share/cups/drivers/PSMON.DLL as \WIN40/PSMON.DLL (18666.1 kb/s)
614 (average 13266.7 kb/s)
616 Running command: rpcclient localhost -N -U'root%secret' -c 'adddriver "Windows NT x86"
617 "infotec_IS2027:ADOBEPS5.DLL:infotec_IS2027.PPD:ADOBEPSU.DLL:ADOBEPSU.HLP:NULL:RAW:NULL"'
618 cmd = adddriver "Windows NT x86" "infotec_IS2027:ADOBEPS5.DLL:infotec_IS2027.PPD:ADOBEPSU.DLL:
619 ADOBEPSU.HLP:NULL:RAW:NULL"
620 Printer Driver infotec_IS2027 successfully installed.
622 Running command: rpcclient localhost -N -U'root%secret' -c 'adddriver "Windows 4.0"
623 "infotec_IS2027:ADOBEPS4.DRV:infotec_IS2027.PPD:NULL:ADOBEPS4.HLP:PSMON.DLL:RAW:
624 ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"'
625 cmd = adddriver "Windows 4.0" "infotec_IS2027:ADOBEPS4.DRV:infotec_IS2027.PPD:NULL:
626 ADOBEPS4.HLP:PSMON.DLL:RAW:ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"
627 Printer Driver infotec_IS2027 successfully installed.
629 Running command: rpcclient localhost -N -U'root%secret'
630 -c 'setdriver infotec_IS2027 infotec_IS2027'
631 cmd = setdriver infotec_IS2027 infotec_IS2027
632 Succesfully set infotec_IS2027 to driver infotec_IS2027.
634 <prompt>root# </prompt>
635 </programlisting></para>
637 <para>
638 If you look closely, you'll discover your root password was transfered unencrypted over
639 the wire, so beware! Also, if you look further her, you'll discover error messages like
640 <constant>NT_STATUS_OBJECT_NAME_COLLISION</constant> in between. They occur, because
641 the directories <filename>WIN40</filename> and <filename>W32X86</filename> already
642 existed in the [print$] driver download share (from a previous driver
643 installation). They are harmless here.
644 </para>
646 <para>
647 Now your printer is prepared for the clients to use. From
648 a client, browse to the CUPS/Samba server, open the "Printers"
649 share, right-click on this printer and select "Install..." or
650 "Connect..." (depending on the Windows version you use). Now their
651 should be a new printer in your client's local "Printers" folder,
652 named (in my case) "infotec_IS2027 on kdebitshop"
653 </para>
655 <para>
656 <emphasis>NOTE: </emphasis>
657 <command>cupsaddsmb</command> will only reliably work i
658 with CUPS version 1.1.15 or higher
659 and Samba from 2.2.4. If it doesn't work, or if the automatic printer
660 driver download to the clients doesn't succeed, you can still manually
661 install the CUPS printer PPD on top of the Adobe PostScript driver on
662 clients and then point the client's printer queue to the Samba printer
663 share for connection, should you desire to use the CUPS networked
664 PostScript RIP functions.
665 </para>
666 </sect2>
667 </sect1>
670 <sect1>
671 <title>The CUPS Filter Chains</title>
673 <para>
674 The following diagrams reveal how CUPS handles print jobs.
675 </para>
677 <programlisting>
678 #########################################################################
680 # CUPS in and of itself has this (general) filter chain (CAPITAL
681 # letters are FILE-FORMATS or MIME types, other are filters (this is
682 # true for pre-1.1.15 of pre-4.3 versions of CUPS and ESP PrintPro):
684 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
688 # <replaceable>something</replaceable>tops
692 # APPLICATION/POSTSCRIPT
696 # pstops
700 # APPLICATION/VND.CUPS-POSTSCRIPT
704 # pstoraster # as shipped with CUPS, independent from any Ghostscipt
705 # | # installation on the system
706 # | (= "postscipt interpreter")
709 # APPLICATION/VND.CUPS-RASTER
713 # rasterto<replaceable>something</replaceable> (f.e. Gimp-Print filters may be plugged in here)
714 # | (= "raster driver")
717 # SOMETHING-DEVICE-SPECIFIC
721 # backend
724 # ESP PrintPro has some enhanced "rasterto<replaceable>something</replaceable>" filters as compared to
725 # CUPS, and also a somewhat improved "pstoraster" filter.
727 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
728 # CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
730 #########################################################################
731 </programlisting>
733 <programlisting>
734 #########################################################################
736 # This is how "cupsomatic" comes into play:
737 # =========================================
739 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
743 # <replaceable>something</replaceable>tops
747 # APPLICATION/POSTSCRIPT
751 # pstops
755 # APPLICATION/VND.CUPS-POSTSCRIPT ----------------+
756 # | |
757 # | V
758 # V cupsomatic
759 # pstoraster (constructs complicated
760 # | (= "postscipt interpreter") Ghostscript commandline
761 # | to let the file be
762 # V processed by a
763 # APPLICATION/VND.CUPS-RASTER "-sDEVICE=<replaceable>s.th.</replaceable>"
764 # | call...)
765 # | |
766 # V |
767 # rasterto<replaceable>something</replaceable> V
768 # | (= "raster driver") +-------------------------+
769 # | | Ghostscript at work.... |
770 # V | |
771 # SOMETHING-DEVICE-SPECIFIC *-------------------------+
772 # | |
773 # | |
774 # V |
775 # backend &gt;------------------------------------+
779 # THE PRINTER
782 # Note, that cupsomatic "kidnaps" the printfile after the
783 # "APPLICATION/VND.CUPS-POSTSCRPT" stage and deviates it through
784 # the CUPS-external, systemwide Ghostscript installation, bypassing the
785 # "pstoraster" filter (therefor also bypassing the CUPS-raster-drivers
786 # "rasterto<replaceable>something</replaceable>", and hands the rasterized file directly to the CUPS
787 # backend...
789 # cupsomatic is not made by the CUPS developers. It is an independent
790 # contribution to printing development, made by people from
791 # Linuxprinting.org. (see also http://www.cups.org/cups-help.html)
793 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
794 # CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
796 #########################################################################
797 </programlisting>
799 <programlisting>
800 #########################################################################
802 # And this is how it works for ESP PrintPro from 4.3:
803 # ===================================================
805 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
809 # <replaceable>something</replaceable>tops
813 # APPLICATION/POSTSCRIPT
817 # pstops
821 # APPLICATION/VND.CUPS-POSTSCRIPT
825 # gsrip
826 # | (= "postscipt interpreter")
829 # APPLICATION/VND.CUPS-RASTER
833 # rasterto<replaceable>something</replaceable> (f.e. Gimp-Print filters may be plugged in here)
834 # | (= "raster driver")
837 # SOMETHING-DEVICE-SPECIFIC
841 # backend
843 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
844 # CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
846 #########################################################################
847 </programlisting>
849 <programlisting>
850 #########################################################################
852 # This is how "cupsomatic" would come into play with ESP PrintPro:
853 # ================================================================
856 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
860 # <replaceable>something</replaceable>tops
864 # APPLICATION/POSTSCRIPT
868 # pstops
872 # APPLICATION/VND.CUPS-POSTSCRIPT ----------------+
873 # | |
874 # | V
875 # V cupsomatic
876 # gsrip (constructs complicated
877 # | (= "postscipt interpreter") Ghostscript commandline
878 # | to let the file be
879 # V processed by a
880 # APPLICATION/VND.CUPS-RASTER "-sDEVICE=<replaceable>s.th.</replaceable>"
881 # | call...)
882 # | |
883 # V |
884 # rasterto<replaceable>something</replaceable> V
885 # | (= "raster driver") +-------------------------+
886 # | | Ghostscript at work.... |
887 # V | |
888 # SOMETHING-DEVICE-SPECIFIC *-------------------------+
889 # | |
890 # | |
891 # V |
892 # backend &gt;------------------------------------+
896 # THE PRINTER
898 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
899 # CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
901 #########################################################################
902 </programlisting>
904 <programlisting>
905 #########################################################################
907 # And this is how it works for CUPS from 1.1.15:
908 # ==============================================
910 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
914 # <replaceable>something</replaceable>tops
918 # APPLICATION/POSTSCRIPT
922 # pstops
926 # APPLICATION/VND.CUPS-POSTSCRIPT-----+
928 # +------------------v------------------------------+
929 # | Ghostscript |
930 # | at work... |
931 # | (with |
932 # | "-sDEVICE=cups") |
933 # | |
934 # | (= "postscipt interpreter") |
935 # | |
936 # +------------------v------------------------------+
939 # APPLICATION/VND.CUPS-RASTER &gt;-------+
943 # rasterto<replaceable>something</replaceable>
944 # | (= "raster driver")
947 # SOMETHING-DEVICE-SPECIFIC
951 # backend
954 # NOTE: since version 1.1.15 CUPS "outsourced" the pstoraster process to
955 # Ghostscript. GNU Ghostscript needs to be patched to handle the
956 # CUPS requirement; ESP Ghostscript has this builtin. In any case,
957 # "gs -h" needs to show up a "cups" device. pstoraster is now a
958 # calling an appropriate "gs -sDEVICE=cups..." commandline to do
959 # the job. It will output "application/vnd.cup-raster", which will
960 # be finally processed by a CUPS raster driver "rasterto<replaceable>something</replaceable>"
961 # Note the difference to "cupsomatic", which will *not* output
962 # CUPS-raster, but a final version of the printfile, ready to be
963 # sent to the printer. cupsomatic also doesn't use the "cups"
964 # devicemode in Ghostscript, but one of the classical devicemodes....
966 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
967 # CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
969 #########################################################################
970 </programlisting>
972 <programlisting>
973 #########################################################################
975 # And this is how it works for CUPS from 1.1.15, with cupsomatic included:
976 # ========================================================================
978 # <replaceable>SOMETHNG</replaceable>-FILEFORMAT
982 # <replaceable>something</replaceable>tops
986 # APPLICATION/POSTSCRIPT
990 # pstops
994 # APPLICATION/VND.CUPS-POSTSCRIPT-----+
996 # +------------------v------------------------------+
997 # | Ghostscript . Ghostscript at work.... |
998 # | at work... . (with "-sDEVICE= |
999 # | (with . <replaceable>s.th.</replaceable>" |
1000 # | "-sDEVICE=cups") . |
1001 # | . |
1002 # | (CUPS standard) . (cupsomatic) |
1003 # | . |
1004 # | (= "postscript interpreter") |
1005 # | . |
1006 # +------------------v--------------v---------------+
1007 # | |
1008 # | |
1009 # APPLICATION/VND.CUPS-RASTER &gt;-------+ |
1010 # | |
1011 # | |
1012 # V |
1013 # rasterto<replaceable>something</replaceable> |
1014 # | (= "raster driver") |
1015 # | |
1016 # V |
1017 # SOMETHING-DEVICE-SPECIFIC &gt;------------------------+
1021 # backend
1024 # NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
1025 # CUPS and ESP PrintPro plug-in where rasterto<replaceable>something</replaceable> is noted.
1027 ##########################################################################
1028 </programlisting>
1030 </sect1>
1033 <sect1>
1034 <title>CUPS Print Drivers and Devices</title>
1036 <para>
1037 CUPS ships with good support for HP LaserJet type printers. You can install
1038 the driver as follows:
1040 <itemizedlist>
1041 <listitem><para>
1042 lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -m laserjet.ppd
1043 </para></listitem>
1044 </itemizedlist>
1046 (The "-m" switch will retrieve the "laserjet.ppd" from the standard repository
1047 for not-yet-installed-PPDs, which CUPS typically stores in
1048 <filename>/usr/share/cups/model</filename>. Alternatively, you may use
1049 "-P /absolute/filesystem/path/to/where/there/is/PPD/your.ppd").
1050 </para>
1052 <sect2>
1053 <title>Further printing steps</title>
1055 <para>
1056 Always also consult the database on linuxprinting.org for all recommendations
1057 about which driver is best used for each printer:
1058 </para>
1060 <para><ulink url="http://www.linuxprinting.org/printer_list.cgi">http://www.linuxprinting.org/printer_list.cgi</ulink></para>
1062 <para>
1063 There select your model and click on "Show". You'll arrive at a page listing
1064 all drivers working with your model. There will always be *one*
1065 <emphasis>recommended</emphasis> one. Try this one first. In your case
1066 ("HP LaserJet 4 Plus"), you'll arrive here:
1067 </para>
1069 <para><ulink url="http://www.linuxprinting.org/show_printer.cgi?recnum=75104">http://www.linuxprinting.org/show_printer.cgi?recnum=75104</ulink></para>
1071 <para>
1072 The recommended driver is "ljet4". It has a link to the page for the ljet4
1073 driver too:
1074 </para>
1076 <para><ulink url="http://www.linuxprinting.org/show_driver.cgi?driver=ljet4">http://www.linuxprinting.org/show_driver.cgi?driver=ljet4</ulink></para>
1078 <para>
1079 On the driver's page, you'll find important and detailed info about how to use
1080 that driver within the various available spoolers. You can generate a PPD for
1081 CUPS. The PPD contains all the info about how to use your model and the driver;
1082 this is, once installed, working transparently for the user -- you'll only
1083 need to choose resolution, paper size etc. from the web-based menu or from
1084 the print dialog GUI or from the commandline...
1085 </para>
1087 <para>
1088 On the driver's page, choose to use the "PPD-O-Matic" online PPD generator
1089 program. Select your model and click "Generate PPD file". When you safe the
1090 appearing ASCII text file, don't use "cut'n'past" (as it could possiblly corrupt
1091 line endings and tabs), but use "Save as..." in your browser's menu. Save it
1092 at "/some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd"
1093 </para>
1095 <para>
1096 Then install the printer:
1097 </para>
1098 <para><programlisting>
1099 "lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E \
1100 -P /some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd"
1101 </programlisting></para>
1103 <para>
1104 Note, that for all the "Foomatic-PPDs" from Linuxprinting.org, you also need
1105 a special "CUPS filter" named "cupsomatic". Get the latest version of
1106 "cupsomatic" from:
1107 </para>
1109 <para><ulink url="http://www.linuxprinting.org/cupsomatic">http://www.linuxprinting.org/cupsomatic</ulink></para>
1111 <para>
1112 This needs to be copied to <filename>/usr/lib/cups/filter/cupsomatic</filename>
1113 and be made world executable. This filter is needed to read and act upon the
1114 specially encoded Foomatic comments, embedded in the printfile, which in turn
1115 are used to construct (transparently for you, the user) the complicated
1116 ghostscript command line needed for your printer/driver combo.
1117 </para>
1119 <para>
1120 You can have a look at all the options for the Ghostscript commandline supported
1121 by your printer and the ljet4 driver by going to the section "Execution details",
1122 selecting your model (Laserjet 4 Plus) and clicking on "Show execution details".
1123 This will bring up this web page:
1124 </para>
1126 <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>
1128 <para>
1129 The ingenious thing is that the database is kept current. If there
1130 is a bug fix and an improvement somewhere in the database, you will
1131 always get the most current and stable and feature-rich driver by following
1132 the steps described above.
1133 </para>
1135 <note><para>
1136 Till Kamppeter from MandrakeSoft is doing an excellent job here that too few
1137 people are aware of. (So if you use it often, please send him a note showing
1138 your appreciation).</para></note>
1140 <para>
1141 The latest and greatest improvement now is support for "custom page sizes"
1142 for all those printers which support it.
1143 </para>
1145 <para>
1146 "cupsomatic" is documented here:
1147 </para>
1149 <para><ulink url="http://www.linuxprinting.org/cups-doc.html">http://www.linuxprinting.org/cups-doc.html</ulink></para>
1151 <para>
1152 More printing tutorial info may be found here:
1153 </para>
1155 <para><ulink url="http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/">http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/</ulink></para>
1157 <para>
1158 Note, that *all* the Foomatic drivers listed on Linuxprinting.org (now
1159 approaching the "all-time high" number of 1.000 for the supported models)
1160 are using a special filtering chain involving Ghostscript, as described
1161 in this document.
1162 </para>
1164 <para>
1165 Summary - You need:
1166 </para>
1168 <para>
1169 <simplelist>
1171 <member>A "foomatic+<replaceable>something</replaceable>" PPD is not enough to print with CUPS (but it is *one* important component)</member>
1172 <member>The "cupsomatic" filter script (Perl) in <filename>/usr/lib/cups/filters/</filename></member>
1173 <member>Perl to make cupsomatic run</member>
1174 <member>Ghostscript (because it is called and controlled by the PPD/cupsomatic combo in a way to fit your printermodel/driver combo.</member>
1175 <member>Ghostscript *must*, depending on the driver/model, contain support for a certain "device" (as shown by "gs -h")</member>
1176 </simplelist>
1177 </para>
1179 <para>
1180 In the case of the "hpijs" driver, you need a Ghostscript version, which
1181 has "ijs" amongst its supported devices in "gs -h". In the case of
1182 "hpijs+foomatic", a valid ghostscript commandline would be reading like this:
1183 </para>
1185 <para><programlisting>
1186 gs -q -dBATCH -dPARANOIDSAFER -dQUIET -dNOPAUSE -sDEVICE=ijs \
1187 -sIjsServer=hpijs<replaceable>PageSize</replaceable> -dDuplex=<replaceable>Duplex</replaceable> <replaceable>Model</replaceable> \
1188 -r<replaceable>Resolution</replaceable>,PS:MediaPosition=<replaceable>InputSlot</replaceable> -dIjsUseOutputFD \
1189 -sOutputFile=- -
1190 </programlisting></para>
1192 <note><para>
1193 Note, that with CUPS and the "hpijs+foomatic" PPD (plus Perl and cupsomatic)
1194 you don't need to remember this. You can choose the available print options
1195 thru a GUI print command (like "glp" from ESP's commercially supported
1196 PrintPro software, or KDE's "kprinter", or GNOME's "gtklp" or the independent
1197 "xpp") or the CUPS web interface via human-readable drop-down selection
1198 menus.
1199 </para></note>
1201 <para>
1202 If you use "ESP Ghostscript" (also under the GPL, provided by Easy Software
1203 Products, the makers of CUPS, downloadable from
1204 <ulink url="http://www.cups.org/software.html">http://www.cups.org/software.html</ulink>,
1205 co-maintained by the developers of linuxprinting.org), you are guaranteed to
1206 have in use the most uptodate, bug-fixed, enhanced and stable version of a Free
1207 Ghostscript. It contains support for ~300 devices, whereas plain vanilla
1208 GNU Ghostscript 7.05 only has ~200.
1209 </para>
1211 <para>
1212 If you print only one CUPS test page, from the web interface and when you try to
1213 print a windows test page, it acts like the job was never sent:
1215 <simplelist>
1216 <member>Can you print "standard" jobs from the CUPS machine?</member>
1217 <member>Are the jobs from Windows visible in the Web interface on CUPS (http://localhost:631/)?</member>
1218 <member><emphasis>Most important:</emphasis> What kind of printer driver are you using on the Windows clients?</member>
1219 </simplelist>
1221 You can try to get a more detailed debugging info by setting "LogLevel debug" in
1222 <filename>/etc/cups/cupsd.conf</filename>, re-start cupsd and investigate <filename>/var/log/cups/error_log</filename>
1223 for the whereabouts of your Windows-originating printjobs:
1224 </para>
1226 <simplelist>
1227 <member>what does the "auto-typing" line say? which is the "MIME type" CUPS thinks is arriving from the Windows clients?</member>
1228 <member>are there "filter" available for this MIME type?</member>
1229 <member>are there "filter rules" defined in "/etc/cups/mime.convs" for this MIME type?</member>
1230 </simplelist>
1232 </sect2>
1234 </sect1>
1237 <sect1>
1238 <title>Limiting the number of pages users can print</title>
1240 <para>
1241 The feature you want is dependent on the real print subsystem you're using.
1242 Samba's part is always to receive the job files from the clients (filtered
1243 *or* unfiltered) and hand it over to this printing subsystem.
1244 </para>
1246 <para>
1247 Of course one could "hack" things with one's own scripts.
1248 </para>
1250 <para>
1251 But there is CUPS (Common Unix Printing System). CUPS supports "quotas".
1252 Quotas can be based on sizes of jobs or on the number of pages or both,
1253 and are spanning any time period you want.
1254 </para>
1256 <para>
1257 This is an example command how root would set a print quota in CUPS,
1258 assuming an existing printer named "quotaprinter":
1259 </para>
1261 <programlisting>
1262 lpadmin -p quotaprinter -o job-quota-period=604800 -o job-k-limit=1024 \
1263 -o job-page-limit=100
1264 </programlisting>
1266 <para>
1267 This would limit every single user to print 100 pages or 1024 KB of
1268 data (whichever comes first) within the last 604.800 seconds ( = 1 week).
1269 </para>
1271 <para>
1272 For CUPS to count correctly, the printfile needs to pass the CUPS "pstops" filter,
1273 otherwise it uses a "dummy" count of "1". Some printfiles don't pass it
1274 (eg: image files) but then those are mostly 1 page jobs anyway. This also means,
1275 proprietary drivers for the target printer running on the client computers and
1276 CUPS/Samba then spooling these files as "raw" (i.e. leaving them untouched, not
1277 filtering them), will be counted as "1-pagers" too!
1278 </para>
1280 <para>
1281 You need to send PostScript from the clients (i.e. run a PostScript driver there)
1282 for having the chance to get accounting done. If the printer is a non-PostScript model,
1283 you need to let CUPS do the job to convert the file to a print-ready format for the
1284 target printer. This will be working for currently ~1.000 different printer models, see
1285 </para>
1287 <programlisting>
1288 http://www.linuxprinting.org/printer_list.cgi
1289 </programlisting>
1291 <para>
1292 Before CUPS-1.1.16 your only option was to use the Adobe PostScript
1293 Driver on the Windows clients. The output of this driver was not always
1294 passed thru the "pstops" filter on the CUPS/Samba side, and therefor was
1295 not counted correctly (the reason is that it often --- depending on the
1296 "PPD" being used --- did write a "PJL"-header in front of the real
1297 PostScript which made CUPS to skip the pstops and go directy to
1298 the "pstoraster" stage).
1299 </para>
1301 <para>
1302 From CUPS-1.1.16 onward you can use the "CUPS PostScript Driver
1303 for Windows NT/2K/XP clients" (it is tagged in the download area of
1304 http://www.cups.org/ as the "cups-samba-1.1.16.tar.gz" package).
1305 It is *not* working for Win9x/ME clients. But it:
1306 </para>
1308 <simplelist>
1309 <member>it guarantees to not write an PJL-header</member>
1310 <member>it guarantees to still read and support all PJL-options named in the driver PPD with its own means</member>
1311 <member>it guarantees the file going thru the "pstops" filter on the CUPS/Samba server</member>
1312 <member>it guarantees to page-count correctly the printfile</member>
1313 </simplelist>
1315 <para>
1316 You can read more about the setup of this combination in the
1317 manpage for "cupsaddsmb" (only present with CUPS installed, only
1318 current with CUPS 1.1.16).
1319 </para>
1321 <para>
1322 These are the items CUPS logs in the "page_log" for every single *page* of a job:
1323 </para>
1325 <para><simplelist>
1326 <member>Printer name</member>
1327 <member>User name</member>
1328 <member>Job ID</member>
1329 <member>Time of printing</member>
1330 <member>the page number</member>
1331 <member>the number of copies</member>
1332 <member>a billing info string (optional)</member>
1333 </simplelist>
1334 </para>
1336 <para>
1337 Here is an extract of my CUPS server's page_log file to illustrate
1338 the format and included items:
1339 </para>
1341 <para><computeroutput>
1342 infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 1 2 #marketing
1343 infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 2 2 #marketing
1344 infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 3 2 #marketing
1345 infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 4 2 #marketing
1346 infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 5 2 #marketing
1347 infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 6 2 #marketing
1348 </computeroutput></para>
1350 <para>
1351 This was Job ID "40", printed on "infotec_IS2027" by user "kurt", a 6-page job
1352 printed in 2 copies and billed to "#marketing"...
1353 </para>
1355 <para>
1356 What flaws or shortcomings are there?
1357 </para>
1359 <simplelist>
1360 <member>the ones named above</member>
1362 <member>
1363 CUPS really counts the job pages being *processsed in software*
1364 (going thru the "RIP") rather than the physical sheets successfully
1365 leaving the printing device -- if there is a jam while printing
1366 the 5th sheet out of 1000 and the job is aborted by the printer,
1367 the "page count" will still show the figure of 1000 for that job
1368 </member>
1370 <member>
1371 all quotas are the same for all users (no flexibility to give the
1372 boss a higher quota than the clerk) no support for groups
1373 </member>
1375 <member>
1376 no means to read out the current balance or "used-up" number of current quota
1377 </member>
1379 <member>
1380 a user having used up 99 sheets of 100 quota will still be able to send and print a 1.000 sheet job
1381 </member>
1383 <member>
1384 a user being denied a job because of a filled-up quota doesn't get a meaningful
1385 error message from CUPS other than "client-error-not-possible".
1386 </member>
1387 </simplelist>
1389 <para>
1390 But this is the best system out there currently. And there are
1391 huge improvements under development:
1392 </para>
1394 <simplelist>
1395 <member>page counting will go into the "backends" (these talk
1396 directly to the printer and will increase the count in sync with the
1397 actual printing process -- a jam at the 5th sheet will lead to a stop in the counting)</member>
1399 <member>quotas will be handled more flexibly</member>
1401 <member>probably there will be support for users to inquire their "accounts" in advance</member>
1403 <member>probably there will be support for some other tools around this topic</member>
1404 </simplelist>
1406 <para>
1407 Other than the current stage of the CUPS development, I don't
1408 know any other ready-to-use tool which you could consider.
1409 </para>
1411 <para>
1412 You can download the driver files from
1413 <ulink url="http://www.cups.org/software.html">http://www.cups.org/software.html</ulink>.
1414 It is a separate package from the CUPS base software files, tagged as "CUPS 1.1.16
1415 Windows NT/2k/XP Printer Driver for SAMBA (tar.gz, 192k)". The filename to
1416 download is "cups-samba-1.1.16.tar.gz". Upon untar-/unzip-ping it will reveal
1417 the files:
1418 </para>
1420 <para>
1421 <computeroutput>
1422 cups-samba.install
1423 cups-samba.license
1424 cups-samba.readme
1425 cups-samba.remove
1426 cups-samba.ss
1427 </computeroutput>
1428 </para>
1430 <para>
1431 These have been packaged with the ESP meta packager software "EPM". The
1432 *.install and *.remove files are simple shell script, which untars the
1433 *.ss (which is nothing else than a tar-archive) and puts its contents
1434 into <filename>/usr/share/cups/drivers/</filename>. Its contents are 3 files:
1435 </para>
1437 <para>
1438 <computeroutput>
1439 cupsdrvr.dll
1440 cupsui.dll
1441 cups.hlp
1442 </computeroutput>
1443 </para>
1445 <caution><para>
1446 Due to a bug one CUPS release puts the <filename>cups.hlp</filename>
1447 into <filename>/usr/share/drivers/</filename> instead of
1448 <filename>/usr/share/cups/drivers/</filename>. To work around this, copy/move
1449 the file after running the "./cups-samba.install" script manually to the right place:
1450 </para>
1452 <para>
1453 <userinput> cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/
1454 </userinput>
1455 </para></caution>
1457 <note>
1458 <para>
1459 This new CUPS PostScript driver is currently binary-only, but free
1460 no source code is provided (yet). The reason is this: it has
1461 been developed with the help of the Microsoft Driver Developer Kit (DDK)
1462 and compiled with Microsoft Visual Studio 6. It is not clear to the driver
1463 developers if they are allowed to distribute the whole of the source code
1464 as Free Software. However, they will likely release the "diff" in source
1465 code under the GPL, so anybody with a license of Visual Studio and a DDK
1466 will be able to compile for him/herself.
1467 </para>
1469 <para>
1470 Once you have run the install script (and possibly manually moved the
1471 "cups.hlp" file to "/usr/share/cups/drivers/"), the driver is ready to be
1472 put into Samba's [print$] share (which often maps to "/etc/samba/drivers/"
1473 and contains a subdir tree with WIN40 and W32X86 branches), by running
1474 "cupsaddsmb" (see also "man cupsaddsmb" for CUPS 1.1.16). [Don't forget to
1475 put root into the smbpasswd file by running "smbpasswd" should you run
1476 this whole procedure for the first time.] Once the driver files are in the
1477 [print$] share, they are ready to be downloaded and installed by the
1478 Win NT/2k/XP clients.
1479 </para></note>
1482 <note><para>
1483 Win 9x/ME clients won't work with this driver. For these you'd
1484 still need to use the ADOBE*.* drivers as previously.
1485 </para></note>
1487 <note><para>
1488 It is not harming if you've still the ADOBE*.* driver files from
1489 previous installations in the "/usr/share/cups/drivers/" directory.
1490 The new cupsaddsmb (from 1.1.16) will automatically use the
1491 "newest" installed driver (which here then is the CUPS drivers).
1492 </para></note>
1494 <note><para>
1495 Should your Win clients have had the old ADOBE*.* files and the
1496 Adobe PostScript drivers installed, the download and installation
1497 of the new CUPS PostScript driver for Windows NT/2k/XP will fail
1498 at first.
1499 </para>
1500 <para>
1501 It is not enough to "delete" the printer (as the driver files
1502 will still be kept by the clients and re-used if you try to
1503 re-install the printer). To really get rid of the Adobe driver
1504 files on the clients, open the "Printers" folder (possibly via
1505 "Start --> Settings --> Control Panel --> Printers"), right-click
1506 onto the folder background and select "Server Properties". A
1507 new dialog opens; select the "Drivers" tab; on the list select
1508 the driver you want to delete and click on the "Delete" button.
1509 (This will only work if there is no single printer left which
1510 uses that particular driver -- you need to "delete" all printers
1511 using this driver in the "Printers" folder first.)
1512 </para>
1513 </note>
1515 <note><para>
1516 Once you have successfully downloaded the CUPS PostScript driver
1517 to a client, you can easily switch all printers to this one
1518 by proceeding as described elsewhere in the "Samba HOWTO
1519 Collection" to change a driver for an existing printer.
1520 </para></note>
1522 <para>
1523 What are the benefits with the "CUPS PostScript driver for Windows NT/2k/XP"
1524 as compared to the Adobe drivers?
1525 </para>
1527 <para>
1528 <itemizedlist>
1529 <listitem><para>
1530 no hassle with the Adobe EULA
1531 </para></listitem>
1533 <listitem><para>
1534 no hassle with the question "where do I get the ADOBE*.* driver files from?"
1535 </para></listitem>
1537 <listitem><para>
1538 the Adobe drivers (depending on the printer PPD associated with them)
1539 often put a PJL header in front of the core PostScript part of the print
1540 file (thus the file starts with "<replaceable>1B</replaceable>%-12345X" or "<replaceable>escape</replaceable>%-12345X"
1541 instead of "%!PS"). This leads to the CUPS daemon autotyping the
1542 arriving file as a print-ready file, not requiring a pass thru the
1543 "pstops" filter (to speak more technical, it is not regarded as the
1544 generic MIME type "application/postscript", but as the more special
1545 MIME type "application/cups.vnd-postscript"), which therefore also
1546 leads to the page accounting in "/var/log/cups/page_log" not receiving
1547 the exact mumber of pages; instead the dummy page number of "1" is
1548 logged in a standard setup)
1549 </para></listitem>
1551 <listitem><para>
1552 the Adobe driver has more options to "mis-configure" the PostScript
1553 generated by it (like setting it inadvertedly to "Optimize for Speed",
1554 instead of "Optimize for Portability", which could lead to CUPS being
1555 unable to process it)
1556 </para></listitem>
1558 <listitem><para>
1559 the CUPS PostScript driver output sent by Windows clients to the CUPS
1560 server will be guaranteed to be auto-typed as generic MIME type
1561 "application/postscript", thusly passing thru the CUPS "pstops" filter
1562 and logging the correct number of pages in the page_log for accounting
1563 and quota purposes
1564 </para></listitem>
1566 <listitem><para>
1567 the CUPS PostScript driver supports the sending of additional print
1568 options by the Win NT/2k/XP clients, such as naming the CUPS standard
1569 banner pages (or the custom ones, should they be installed at the time
1570 of driver download), using the CUPS "page-label" option, setting a
1571 job-priority and setting the scheduled time of printing (with the option
1572 to support additional useful IPP job attributes in the future).
1573 </para></listitem>
1575 <listitem><para>
1576 the CUPS PostScript driver supports the inclusion of the new
1577 "*cupsJobTicket" comments at the beginnig of the PostScript file (which
1578 could be used in the future for all sort of beneficial extensions on
1579 the CUPS side, but which will not disturb any other application as those
1580 will regard it as a comment and simply ignore it).
1581 </para></listitem>
1583 <listitem><para>
1584 the CUPS PostScript driver will be the heart of the fully fledged CUPS
1585 IPP client for Windows NT/2k/XP to be released soon (probably alongside
1586 the first Beta release for CUPS 1.2).
1587 </para></listitem>
1589 </itemizedlist>
1590 </para>
1591 </sect1>
1593 <sect1>
1594 <title>Advanced Postscript Printing from MS Windows</title>
1596 <para>
1597 Let the Windows Clients use a PostScript driver to deliver poistscript to
1598 the samba print server (just like any Linux or Unix Client would also use
1599 PostScript to send to the server)
1600 </para>
1602 <para>
1603 Make the Unix printing subsystem to which Samba sends the job convert the
1604 incoming PostScript files to the native print format of the target printers
1605 (would be PCL if you have an HP printer)
1606 </para>
1608 <para>
1609 Now if you are afraid that this would just mean using a *Generic* PostScript
1610 driver for the clients that has no Simplex/Duplex selection, and no paper tray
1611 choice, but you need them to be able to set up print jobs, with all the bells
1612 and whistles of your printers:-
1613 </para>
1615 <simplelist>
1616 <member>Not possible with traditional spooling systems</member>
1618 <member>
1619 But perfectly supported by CUPS (which uses "PPD" files to
1620 describe how to control the print options for PostScript and
1621 non-PostScript devices alike...
1622 </member>
1623 </simplelist>
1625 <para>
1626 CUPS PPDs are working perfectly on Windows clients who use Adobe PostScript
1627 drivers (or the new CUPS PostScript driver for Windows NT/2K/XP). Clients can use
1628 them to setup the job to their liking and CUPS will use the received job options
1629 to make the (PCL-, ESC/P- or PostScript-) printer behave as required.
1630 </para>
1632 <para>
1633 If you want to have the additional benefit of page count logging and accounting
1634 then the CUPS PostScript driver is the best choice (better than the Adobe one).
1635 </para>
1637 <para>
1638 If you want to make the drivers downloadable for the clients then "cupsaddsmb" is
1639 your friend. It will setup the [print$] share on the Samba host to be ready to serve
1640 the clients for a "point and print" driver installation.
1641 </para>
1643 <warning>
1644 <para>What strings are attached?</para></warning>
1646 <para>
1647 There are some. But, given the sheer CPU power you can buy nowadays,
1648 these can be overcome easily. The strings:
1649 </para>
1651 <para>
1652 Well, if the CUPS/Samba side will have to print to many printers serving many users,
1653 you probably will need to set up a second server (which can do automatic load balancing
1654 with the first one, plus a degree of fail-over mechanism). Converting the incoming
1655 PostScript jobs, "interpreting" them for non-PostScript printers, amounts to the work
1656 of a "RIP" (Raster Image Processor) done in software. This requires more CPU and RAM
1657 than for the mere "raw spooling" task your current setup is solving. It all depends
1658 on the avarage and peak printing load the server should be able to handle.
1659 </para>
1661 </sect1>
1663 <sect1>
1664 <title>Auto-Deletion of CUPS spool files</title>
1666 <para>
1667 Samba print files pass thru two "spool" directories. One the incoming directory
1668 managed by Samba, (set eg: in the <command>path = /var/spool/samba</command> directive in the [printers]
1669 section of &smb.conf;). Second is the spool directory of your UNIX print subsystem.
1670 For CUPS it is normally "/var/spool/cups/", as set by the cupsd.conf directive
1671 "RequestRoot /var/spool/cups".
1672 </para>
1674 <para>
1675 I am not sure, which one of your directories keeps the files. From what you say,
1676 it is most likely the Samba part.
1677 </para>
1679 <para>
1680 For the CUPS part, you may want to consult:
1681 </para>
1683 <simplelist>
1684 <member>http://localhost:631/sam.html#PreserveJobFiles</member>
1685 <member>http://localhost:631/sam.html#PreserveJobHistory</member>
1686 <member>http://localhost:631/sam.html#MaxJobs</member>
1687 </simplelist>
1689 <para>
1690 There are the settings described for your CUPS daemon, which could lead to completed
1691 job files not being deleted.
1692 </para>
1694 <para>
1695 "PreserveJobHistory Yes" -- keeps some details of jobs in
1696 cupsd's mind (well it keeps the "c12345", "c12346" etc. files
1697 in the CUPS spool directory, which do a similar job as the
1698 old-fashioned BSD-LPD control files). This is set to "Yes"
1699 as a default.
1700 </para>
1702 <para>
1703 "PreserveJobFiles Yes" -- keeps the job files themselves in
1704 cupsd's mind (well it keeps the "d12345", "d12346" etc. files
1705 in the CUPS spool directory...). This is set to "No" as the
1706 CUPS default.
1707 </para>
1709 <para>
1710 "MaxJobs 500" -- this directive controls the maximum number
1711 of jobs that are kept in memory. Once the number of jobs
1712 reaches the limit, the oldest completed job is automatically
1713 purged from the system to make room for the new one. If all
1714 of the known jobs are still pending or active then the new
1715 job will be rejected. Setting the maximum to 0 disables this
1716 functionality. The default setting is 0.
1717 </para>
1719 <para>
1720 (There are also additional settings for "MaxJobsPerUser" and
1721 "MaxJobsPerPrinter"...)
1722 </para>
1724 <para>
1725 For everything to work as announced, you need to have three things:
1726 </para>
1728 <simplelist>
1730 <member>
1731 a Samba-&smbd; which is compiled against "libcups" (Check on Linux by running <userinput>ldd `which smbd`</userinput>)
1732 </member>
1734 <member>
1735 a Samba-&smb.conf; setting of <command>printing = cups</command>
1736 </member>
1738 <member>
1739 another Samba-&smb.conf; setting of <command>printcap = cups</command>
1740 </member>
1742 </simplelist>
1744 <note><para>
1745 Note, that in this case all other manually set printing-related
1746 commands (like "print command", "lpq command", "lprm command",
1747 "lppause command" or "lpresume command") are ignored and they
1748 should normally have no influence what-so-ever on your printing.
1749 </para></note>
1751 <para>
1752 If you want to do things manually, replace the "printing = cups"
1753 by "printing = bsd". Then your manually set commands may work
1754 (haven't tested this), and a "print command = lp -d %P %s; rm %s"
1755 may do what you need.
1756 </para>
1758 <para>
1759 You forgot to mention the CUPS version you're using. If you did
1760 set things up as described in the man pages, then the Samba
1761 spool files should be deleted. Otherwise it may be a bug. On
1762 the CUPS side, you can control the behaviour as described
1763 above.
1764 </para>
1766 <para>
1767 If you have more problems, post the output of these commands:
1768 </para>
1770 <para>
1771 <userinput>
1772 grep -v ^# /etc/cups/cupsd.conf | grep -v ^$
1773 grep -v ^# /etc/samba/smb.conf | grep -v ^$ | grep -v "^;"
1774 </userinput>
1775 </para>
1777 <para>
1778 (adapt paths as needed). These commands sanitize the files
1779 and cut out the empty lines and lines with comments, providing
1780 the "naked settings" in a compact way.
1781 </para>
1782 </sect1>
1783 </chapter>