From 85ed4d74588d54815d547f5a0ca52ca701c96507 Mon Sep 17 00:00:00 2001 From: John Terpstra Date: Fri, 22 Nov 2002 19:49:14 +0000 Subject: Added more notes from Samba Mailing List so this info does not get lost! (This used to be commit 371c89b93120fb1ced317de365aad64fd1c3cb27) --- docs/textdocs/CUPS-PrintingInfo.txt | 439 ++++++++++++++++++++++++++++++++++++ 1 file changed, 439 insertions(+) diff --git a/docs/textdocs/CUPS-PrintingInfo.txt b/docs/textdocs/CUPS-PrintingInfo.txt index bbe14f33e8..c6713cb7a9 100644 --- a/docs/textdocs/CUPS-PrintingInfo.txt +++ b/docs/textdocs/CUPS-PrintingInfo.txt @@ -1,3 +1,15 @@ +There are Four (4) Extracts here from mail in the Samba Mailing List. +The key contribution here is from Kurt Pfeifle. + +I added them to this repository in the hope that someone would find the information helpful. +John T. + +============================================================================== +<<< EXTANT 1 >>> +============================================================================== +Subject: Print Filtering Mechanism Explained +============================================ + Date: Sun, 22 Sep 2002 15:38:02 +0200 From: "Kurt Pfeifle" Reply-To: kpfeifle@danka.de @@ -587,3 +599,430 @@ I hope this helps more people understand how CUPS works and how they can possibly tweak it to their needs. +============================================================================== +<<< EXTANT 2 >>> +============================================================================== +Subject: Print Drivers and Devices with CUPS +============================================ + +CUPS ships a well-working Laserjet driver. Install it (as root) with + + "lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -m laserjet.ppd" + +(The "-m" switch will retrieve the "laserjet.ppd" from the standard repository +for not-yet-installed-PPDs, which CUPS keeps at "/usr/share/cups/model/". Alter- +natively, you may use "-P /absolute/filesystem/path/to/where/there/is/PPD/your.ppd") + +You didn't state if the print system is working on the Linux side of things. +Even if it does -- to print from Windows, involves some more steps.... + +But let me first point out some more general things about printer "drivers" +for Linux/Unix (yes, and for Mac OS X now!), be it you use CUPS or one of +the venerable (I'd even call them "ancient" and "rusty" now...) printing +systems. + +You -- and everybody else, for that matter -- should always also consult the +database on linuxprinting.org for all recommendations about "which driver +is best used for which printer": + + http://www.linuxprinting.org/printer_list.cgi + +There select your model and click on "Show". You'll arrive at a page listing +all drivers working with your model. There will always be *one* "recommended" +one. Try this one first. In your case ("HP LaserJet 4 Plus"), you'll arrive +here: + + http://www.linuxprinting.org/show_printer.cgi?recnum=75104 + +The recommended driver is "ljet4". It has a link to the page for the ljet4 +driver too: + + http://www.linuxprinting.org/show_driver.cgi?driver=ljet4 + +On the driver's page, you'll find various important and detailed infos about +how to use that driver within various spoolers. You can generate a PPD for +CUPS. The PPD contains all the info about how to use your model and the driver; +this is, once installed, working transparently for the user -- you'll only +need to choose resolution, paper size etc. from the web-based menu or from +the print dialog GUI or from the commandline... + +On the driver's page, choose to use the "PPD-O-Matic" online PPD generator +program. Select your model and click "Generate PPD file". When you safe the +appearing ASCII text file, don't use "cut'n'past" (as it will possible corrupt +line endings and tabs), but use "Save as..." in your browser's menu. Save it +at "/some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd" + +Then install the printer: + + "lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -P /some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd" + +Note, that for all the "Foomatic-PPDs" from Linuxprinting.org, you also need +a special "CUPS filter" named "cupsomatic". Get the latest version of +"cupsomatic" from + + http://www.linuxprinting.org/cupsomatic + +This needs to be copied to "/usr/lib/cups/filter/cupsomatic" and be made world +executable. This filter is needed to read and act upon the specially encoded +Foomatic comments, embedded in the printfile, which in turn are used to +construct (transparently for you, the user) the complicated ghostscript command +line needed for your printer/driver combo. + +You can have a look at all the options for the Ghostscript commandline supported +by your printer and the ljet4 driver by going to the section "Execution details", +selecting your model (Laserjet 4 Plus) and clicking on "Show execution details". +This will bring up this web page: + + http://www.linuxprinting.org/execution.cgi?driver=ljet4&printer=75104&.submit=Show+execution+details + +The ingenious thing is this: the database is kept very current. If there +is a bug fix and an improvement somewhere in the database, you will +always get the most current and stable and feature-rich driver by following +the steps described above... Till Kamppeter from MandrakeSoft is doing an +excellent job here, and too few people still know about it. (So if you use +it often, please send him a note of your appreciation sometime...) + +(The latest and greatest improvement now is support for "custom page sizes" +for all those printers which support it...) + +"cupsomatic" is documented here: + + http://www.linuxprinting.org/cups-doc.html + +More printing tutorial info may be found here: + + http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/ + +Note, that *all* the Foomatic drivers listed on Linuxprinting.org (now +approaching the "all-time high" number of 1.000 for the supported models) +are using a special filtering chain involving Ghostscript, as described +in great detail in the Samba CVS sources (for 2.2.x) in + + docs/textdocs/CUPS-PrintingInfo.txt + +To sum it up: + +* having a "foomatic+" PPD is not enough to print with CUPS + (but it is *one* important component) +* you also need the "cupsomatic" filter script (Perl) in "/usr/lib/cups/filters/" +* you need Perl to make cupsomatic run +* you also need Ghostscript (because it is called and controlled by the + PPD/cupsomatic combo in a way to fit your printermodel/driver combo...) +* your Ghostscript *must*, depending on the driver/model, contain support + for a certain "device" (as shown by "gs -h") + +In the case of the "hpijs" driver, you need a Ghostscript version, which +is showing a "ijs" amongst its supported devices in "gs -h". In the case of +"hpijs+foomatic", a valid ghostscript commandline would be reading like this: + + gs -q -dBATCH -dPARANOIDSAFER -dQUIET -dNOPAUSE -sDEVICE=ijs \ + -sIjsServer=hpijs -dDuplex= \ + -r,PS:MediaPosition= -dIjsUseOutputFD \ + -sOutputFile=- - + +Note, that with CUPS and the "hpijs+foomatic" PPD (plus Perl and cupsomatic) +you don't need to remember this. You can choose the available print options +thru a GUI print command (like "glp" from ESP's commercially supported +PrintPro software, or KDE's "kprinter", or GNOME's "gtklp" or the independent +"xpp") or the CUPS web interface via human-readable drop-down selection +menus..... + +If you use "ESP Ghostscript" (also under the GPL, provided by Easy Software +Products, the makers of CUPS, downloadable from http://www.cups.org/software.html, +co-maintained by the developers of linuxprinting.org), you are guaranteed to +have in use the most uptodate, bug-fixed, enhanced and stable version of a Free +Ghostscript. It contains support for ~300 devices, whereas plain vanilla +GNU Ghostscript 7.05 only has ~200.... + +>>/ However, I can only print a Cups test page, from the web interface. when I +/>>/ try to print a windows test page, it acts like the job was never sent. +/ + * Can you print "standard" jobs from the CUPS machine? + + * Are the jobs from Windows visible in the Web interface on CUPS + (http://localhost:631/)? + +*Most important:* What kind of printer driver are you using on the Windows clients??? + +You can try to get a more detailed debugging info by setting "LogLevel debug" in +"/etc/cups/cupsd.conf", re-start cupsd and investigate "/var/log/cups/error_log" +for the whereabouts of your Windows-originating printjobs: + + * what does the "auto-typing" line say? which is the "MIME type" CUPS thinks + is arriving from the Windows clients? + * are there "filter" available for this MIME type? + * are there "filter rules" defined in "/etc/cups/mime.convs" for this MIME type? + +============================================================================== +<<< EXTANT 3 >>> +============================================================================== +Subject: Printer Drivers +======================== + +>> Where can I find a program or how can I configure my samba server in order +>> to limit the number of pages to be printed by users. + +The feature you want is dependent on the real print subsystem +you're using. Samba's part is always to receive the job files +from the clients (filtered *or* unfiltered) and hand it over +to this printing subsystem. + +Of course one could "hack" things with one's own scripts. + +But there is CUPS (Common Unix Printing System). CUPS supports "quotas". +Quotas can be based on sizes of jobs or on the number of pages or both, +and are spanning any time period you want. + +This is an example command how root would set a print quota in CUPS, +assuming an existing printer named "quotaprinter": + + lpadmin -p quotaprinter -o job-quota-period=604800 -o job-k-limit=1024 -o job-page-limit=100 + +This would limit every single user to print 100 pages or 1024 KB of +data (whichever comes first) within the last 604.800 seconds ( = 1 week). + +For CUPS to count correctly, the printfile needs to pass the CUPS +"pstops" filter, otherwise it uses a "dummy" count of "1". (Some +printfiles don't pass it -- f.e. image files -- but then those are +mostly 1 page jobs anyway). This also means, proprietary drivers for +the target printer running on the client computers and CUPS/Samba +then spooling these files as "raw" (i.e. leaving them untouched, not +filtering them), will be counted as "1-pagers" too! + +You need to send PostScript from the clients (i.e. run a PostScript +driver there) for having the chance to get accounting done. If the +printer is a non-PostScript model, you need to let CUPS do the job to +convert the file to a print-ready format for the target printer. This +will be working for currently ~1.000 different printer models, see + + http://www.linuxprinting.org/printer_list.cgi + +Before CUPS-1.1.16 your only option was to use the Adobe PostScript +Driver on the Windows clients. The output of this driver was not always +passed thru the "pstops" filter on the CUPS/Samba side, and therefor was +not counted correctly (the reason is that it often --- depending on the +"PPD" being used --- did write a "PJL"-header in front of the real +PostScript which made CUPS to skip the pstops and go directy to +the "pstoraster" stage). + + From CUPS-1.1.16 onward you can use the "CUPS PostScript Driver +for Windows NT/2K/XP clients" (it is tagged in the download area of +http://www.cups.org/ as the "cups-samba-1.1.16.tar.gz" package). +It is *not* working for Win9x/ME clients. But it.... + + ...it guarantees to not write an PJL-header; + ...it guarantees to still read and support all PJL-options named + in the driver PPD with its own means; + ...it guarantees the file going thru the "pstops" filter on the + CUPS/Samba server; + ...it guarantees to page-count correctly the printfile... + +You can read more about the setup of this combination in the +manpage for "cupsaddsmb" (only present with CUPS installed, only +current with CUPS 1.1.16). + +These are the items CUPS logs in the "page_log" for every single +*page* of a job: + +* Printer name +* User name +* Job ID +* Time of printing +* the page number +* the number of copies +* a billing info string (optional) + +Here is an extract of my CUPS server's page_log file to illustrate +the format and included items: + +infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 1 2 #marketing +infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 2 2 #marketing +infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 3 2 #marketing +infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 4 2 #marketing +infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 5 2 #marketing +infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 6 2 #marketing + +This was Job ID "40", printed on "infotec_IS2027" by user "kurt", +a 6-page job printed in 2 copies and billed to "#marketing"... + +Which flaws or shortcomings are there? + + * the ones named above; + * CUPS really counts the job pages being *processsed in software* + (going thru the "RIP") rather than the physical sheets successfully + leaving the printing device -- if there is a jam while printing + the 5th sheet out of 1000 and the job is aborted by the printer, + the "page count" will still show the figure of 1000 for that + job; + * all quotas are the same for all users (no flexibility to + give the boss a higher quota than the clerk) + * no support for groups; + * no means to read out the current balance or "used-up" + number of current quota; + * a user having used up 99 sheets of 100 quota will still be + able to send and print a 1.000 sheet job; + * a user being denied a job because of a filled-up quota + doesn't get a meaningful error message from CUPS other than + "client-error-not-possible". + +But this is the best system out there currently. And there are +huge improvements under development: + +--> page counting will go into the "backends" (these talk directly + to the printer and will increase the count in sync with the + actual printing process -- a jam at the 5th sheet will lead + to a stop in the counting...) + +--> quotas will be handled more flexibly; + +--> probably there will be support for users to inquire their + "accounts" in advance; + +--> probably there will be support for some other tools around + this topic... + +Other than the current stage of the CUPS development, I don't +know any other ready-to-use tool which you could consider. + + +============================================================================== +<<< EXTANT 4 >>> +============================================================================== +Subject: More on CUPS Print Drivers +=================================== + +>> If you could get around the EULA, then you could package preinitialized +>> drivers and write the information to smbd's tdbs. We have support for +>> storing driver initialization data already. +> +> Have you heard that you can get CUPS printer drivers exactly for that +> from cups.org? If they are good drivers, this could be very interesting. + +Hi, all, + +I'll give you some more info about the PostScript driver Volker mentioned +above here as a reference. (Maybe one day before the 3.0 release it will +end up as a worked-out paragraph inside the HOWTO collection): + +You can download the driver files from http://www.cups.org/software.html. It +is a separate package from the CUPS base software files, tagged as "CUPS 1.1.16 +Windows NT/2k/XP Printer Driver for SAMBA (tar.gz, 192k)". The filename to +download is "cups-samba-1.1.16.tar.gz". Upon untar-/unzip-ping it will reveal +the files + + cups-samba.install + cups-samba.license + cups-samba.readme + cups-samba.remove + cups-samba.ss + +These have been packaged with the ESP meta packager software "EPM". The +*.install and *.remove files are simple shell script, which untars the +*.ss (which is nothing else than a tar-archive) and puts its contents +into "/usr/share/cups/drivers/". Its contents are 3 files: + + cupsdrvr.dll + cupsui.dll + cups.hlp + +[ ATTENTION: due to a bug the current release puts the "cups.hlp" into + "/usr/share/drivers/" instead of "/usr/share/cups/drivers/". To work + around this, copy/move the file after running the "./cups-samba.install" + script manually to the right place: + + "cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/" ] + +This new CUPS PostScript driver is currently binary-only, but free (as in +free beer); no source code is provided (yet). The reason is this: it has +been developed with the help of the Microsoft Driver Developer Kit (DDK) +and compiled with Microsoft Visual Studio 6. It is not clear to the driver +developers if they are allowed to distribute the whole of the source code +as Free Software. However, they will likely release the "diff" in source +code under the GPL, so anybody with a license of Visual Studio and a DDK +will be able to compile for him/herself. + +Once you have run the install script (and possibly manually moved the +"cups.hlp" file to "/usr/share/cups/drivers/"), the driver is ready to be +put into Samba's [print$] share (which often maps to "/etc/samba/drivers/" +and contains a subdir tree with WIN40 and W32X86 branches), by running +"cupsaddsmb" (see also "man cupsaddsmb" for CUPS 1.1.16). [Don't forget to +put root into the smbpasswd file by running "smbpasswd" should you run +this whole procedure for the first time.] Once the driver files are in the +[print$] share, they are ready to be downloaded and installed by the +Win NT/2k/XP clients. + +NOTE 1: Win 9x/ME clients won't work with this driver. For these you'd + still need to use the ADOBE*.* drivers as previously. + +NOTE 2: It is not harming if you've still the ADOBE*.* driver files from + previous installations in the "/usr/share/cups/drivers/" directory. + The new cupsaddsmb (from 1.1.16) will automatically use the + "newest" installed driver (which here then is the CUPS drivers). + +NOTE 3: Should your Win clients have had the old ADOBE*.* files and the + Adobe PostScript drivers installed, the download and installation + of the new CUPS PostScript driver for Windows NT/2k/XP will fail + at first. + It is not enough to "delete" the printer (as the driver files + will still be kept by the clients and re-used if you try to + re-install the printer). To really get rid of the Adobe driver + files on the clients, open the "Printers" folder (possibly via + "Start --> Settings --> Control Panel --> Printers"), right-click + onto the folder background and select "Server Properties". A + new dialog opens; select the "Drivers" tab; on the list select + the driver you want to delete and click on the "Delete" button. + (This will only work if there is no single printer left which + uses that particular driver -- you need to "delete" all printers + using this driver in the "Printers" folder first...) + +NOTE 4: Once you have successfully downloaded the CUPS PostScript driver + to a client, you can easily switch all printers to this one + by proceeding as described elsewhere in the "Samba HOWTO + Collection" to change a driver for an existing printer.... + + +What are the benefits with the "CUPS PostScript driver for Windows NT/2k/XP" +as compared to the Adobe drivers? + +* no hassle with the Adobe EULA; no hassle with the question "where do I + get the ADOBE*.* driver files from?" + +* the Adobe drivers (depending on the printer PPD associated with them) + often put a PJL header in front of the core PostScript part of the print + file (thus the file starts with "<1B>%-12345X" or "%-12345X" + instead of "%!PS"). This leads to the CUPS daemon autotyping the + arriving file as a print-ready file, not requiring a pass thru the + "pstops" filter (to speak more technical, it is not regarded as the + generic MIME type "application/postscript", but as the more special + MIME type "application/cups.vnd-postscript"), which therefore also + leads to the page accounting in "/var/log/cups/page_log" not receiving + the exact mumber of pages; instead the dummy page number of "1" is + logged in a standard setup...) + +* the Adobe driver has more options to "mis-configure" the PostScript + generated by it (like setting it inadvertedly to "Optimize for Speed", + instead of "Optimize for Portability", which could lead to CUPS being + unable to process it....) + +* the CUPS PostScript driver output sent by Windows clients to the CUPS + server will be guaranteed to be auto-typed as generic MIME type + "application/postscript", thusly passing thru the CUPS "pstops" filter + and logging the correct number of pages in the page_log for accounting + and quota purposes... + +* the CUPS PostScript driver supports the sending of additional print + options by the Win NT/2k/XP clients, such as naming the CUPS standard + banner pages (or the custom ones, should they be installed at the time + of driver download), using the CUPS "page-label" option, setting a + job-priority and setting the scheduled time of printing (with the option + to support additional useful IPP job attributes in the future). + +* the CUPS PostScript driver supports the inclusion of the new + "*cupsJobTicket" comments at the beginnig of the PostScript file (which + could be used in the future for all sort of beneficial extensions on + the CUPS side, but which will not disturb any other application as those + will regard it as a comment and simply ignore it). + +* the CUPS PostScript driver will be the heart of the fully fledged CUPS + IPP client for Windows NT/2k/XP to be released soon (probably alongside + the first Beta release for CUPS 1.2). -- cgit