[Samba] CUPS printing

Kurt Pfeifle kpfeifle at danka.de
Thu Nov 14 16:52:00 GMT 2002


Someone calling himself "linuxpower" adviced on this list:

> Message: 2
> Date: Thu, 14 Nov 2002 07:30:18 +0100 (CET)
> From: =?iso-8859-1?q?linux=20power?= <linuxpower2002 at yahoo.no>
> Subject: Re: [Samba] CUPS printing
> To: samba at lists.samba.org
> 
> --0-1567453496-1037255418=:2514
> Content-Type: text/plain; charset=iso-8859-1
> Content-Transfer-Encoding: 8bit
> 
> 
> Replace -P %p in the print command line with the absolute path to the printer.
 > Bug in samba.

Hi, "linuxpower",

I have read your repeated advice on this list to use "the absolute
path to the printer" inside the print command. On other occasions you
talked about an "absolute path to a printing device". I suppose, you
mean the same thing with both your variants of your wording.

Would you please be so kind to explain to me what you mean by these?
Would you please give an example for an "absolute path to the printer",
for an "absolute path to a printing device" plus an example for the
"print command", as you imagine does work in the cases you advice to
use it?

Sorry, I can't make my mind up about this one. (I wouldn't mind about
this -- but your advices leads to e-mails, directed to *my* mailbox, of
people asking what the *~#?$§& this means...)

Your talking in the context of CUPS about "path to a device", makes it
very likely to be mixed up with the clearly defined technical term
"device URI" which CUPS uses.

On one occasion, you have even given the specific advice

    >>>> Fix it by replacing -P %p with the
    >>>>absolute path to the printing device found in lpstat
    >>>>-v

and on another one (Fri Oct 4 06:55:24 2002) you wrote

    >>>> There is a bug in samba which cannot resolve -P %p
    >>>> in the print command.Replace -P %p with the absolute
    >>>> path to the printer.

Excuse me -- this advice is pure nonsense (while a bug in Samba might
be there). Here are the reasons:

"lpstat -v" on a CUPS based printing system gives something that is named
a "device URI" in all relevant documentation. If it is the "parallel:/dev/lp0"
device-URI, one *could* assume to take the "/dev/lp0" part as a "path", even
an "absolute" path. But what about device-URIs like

    "lpd://10.160.51.131/PORT1"
    "socket://hp-printer:9100"
    "ipp://kde-cups-server/printers/infotec4105"

?? Would you also call "//10.160.51.131/PORT1" or "//hp-printer:9100" or
"//kde-cups-server/printers/infotec4105" an absolute path?

CUPS does encode in the "device-URI" the protocol to be used for the
communication with the printer plus something you might call "absolute
path to the device".

You can't replace inside the Samba "print command" (in smbd.conf) the
"-P %p" part by one of the quoted device URIs...

Your creation and usage of the term of "absolute path" I found nowhere
clearly defined  -- it seems to only lead to utter confusion and urban
legends...

                         ---------

About your conceived "bug in Samba" -- please consider this:

There is also a hint in the smb.conf man page:

   ...*if* the setting is "printing = cups" and "printcap = cups" and
   ...*if* Samba is compiled against libcups,
   ...and *if* there is an entry in "cupsd.conf" to get CUPS to create a
      printcap file ["Printcap /etc/printcap"],

then *any* print command setting in smb.conf will be *ignored*, as samba is
then using a direct access to the CUPS API for printing....

This means: if the two simple settings "printing = cups" and "printcap = cups"
don't work, you probably don't have a smbd which is compiled against
libcups. To check, simply run as root "ldd `which smbd`" (on Linux, dunno
about "ldd" on other Samba platforms).

                         ---------

Now for the original question....

> Mark Belfanti <mark at belfanti.com> wrote:
 >
 > For printing from windows with windopws driver using cups you may need
> to reconfigure to have sups act as a raw print queue. See Chapter 7 of
> Samaba-HowTo-Collection.
> 
> Regards,
> Mark
> 
> On Thu, 2002-11-14 at 13:25, Darin Bawden wrote:
> 
>> Good evening everyone,
>> Kist a quick-type question I hope. I've just switched my Linux server to
>> use Cups instead of LPRng. I can print all day to our HP LaserJet 4 Plus.

Hi, Mark,

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, invelves 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+<something>" 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<PageSize> -dDuplex=<Duplex> <Model>        \
             -r<Resolution>,PS:MediaPosition=<InputSlot> -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?

>> The reason I am not initially posting the smb.conf and/or cupsd.conf is I
>> am not sure this is a Samba issue or cups issue. can anyone advise me which
>> way to go? I'm using samba 2.2.5 and cups 1.1.5 

CUPS 1.1.5 is veeeeeery old.... (unless you mistyped "1.1.15"?) Current and
recommended versions are CUPS 1.1.16 and Samba 2.2.6.

>> FWIW, I'm using the
>> Foomatic+hpijs printer driver.

Which one are you using on the Windows side?
Is the "Foomatic+hpijs" side working on the CUPS side for other than the
testpage jobs? (should be -- otherwise the testpage, which is pure, but very
"intelligent" PostScript, would likely not print either....)

>> I'm not sure where to go with this issue. If this isn't a samba issue,
>> please pardon the OT.

This could be one of both. From your info I can't say yet. If we discuss it
here, there will be no damage to Samba or the Team, even if it is not Samba's
bug...   ;-)

>> Thanks in advance  [:)] 
>> 
>> Darin Bawden
> 
> dbawden at teamdme.com
> -- Mark Belfanti


Cheers,
Kurt






More information about the samba mailing list