[Samba] Creating a PDF queue w/o lpr: works great!

kend at xanoptix.com kend at xanoptix.com
Thu Jan 22 15:35:44 GMT 2004

I want to send a quick "Thank you" to William Enestvedt and Ryan
Novosielski for helping me out.  Creating a PDF queue -- or, perhaps more
accurately, a convert-to-PDF-queue -- was obscenely easy, once I found out
that I needed to quote my environmental variables.  It's so easy, as a
matter of fact, that I'm going to include below the sum total additions to
my smb.conf and the helper script, so's anyone else that wants to
implement it can do so.  It's set up such that, once you've installed an
appropriate postscript driver (I'm using the HP 8500 PS color printer
driver), you simply print to the queue, and a file with the correct name
is then placed in a directory named "pdf" in the user's homedir.
snippet from smb.conf:

        path = /tmp
        browseable = yes
        guest ok = yes
        print command = /usr/local/bin/pdf_q.sh "%U" "%H" "%f" "%p" "%J"
        printable = yes
        lpq command =
        lprm command =


mkdir $2/pdf 2> /dev/null > /dev/null
/usr/bin/ps2pdf /tmp/$3 $2/pdf/"$5".pdf
rm /tmp/$3
I just noticed that I have some extra parameters in the "print command"
line; they spit out various environmental stuff, some of which isn't
needed.  Here's what they all do:
%U: username
%H: homedir
%f: filename (the "spool" filename)
%p: The path to the "spool" area
%J: Job name (the originating filename or URL, based on what the app gives.)

One last caveat: I was unable to get this to work consistently under 2.4;
my 3.0 machines were very, very happy.

Thanks much, all!


> Ken D'Ambrosio wrote:
>> The jobname gives me:
>> For websites:  the URL (which is great)
>> For apps (eg. Word): "Microsoft" (which is less great)
>    It's definitely in the way you qute the directive for Filename in your
> "print command" entry in smb.conf. I use this:
> -----start smb.conf snippet-----
> print command = /usr/local/bin/spr -P test_queue +no-banner +header "%J"
> %s
> ------end smb.conf snippet------
>    (The spr command is part of the Xi-Text print management software I
> use.)
>    If you plan to use this for the names of the PDFs you generate, beware
> of the spaces and/or slashes that the "J%" string will contain, as well
> as the useless "Microsoft"'s that every Office print job will have.
> -wde
> --
> Will Enestvedt
> UNIX System Administrator
> Johnson & Wales University -- Providence, RI

More information about the samba mailing list