[Samba] PDF Printer issue

Buchan Milne bgmilne at cae.co.za
Thu Feb 27 17:00:44 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris Smith wrote:
> On Thu, 2003-02-27 at 08:42, Buchan Milne wrote:
>
>
>>The script in packaging/Mandrake/print-pdf (or something like that) is
>>IMHO a better solution. I can expand as to why if you are interested.
>>
>
> Expansion would be appreciated thank you.

Firstly, the print command should be forked, so that the windows
machines don't block while waiting for the process to finish. That is
why in the default pdf share is like this:

[pdf-generator]
   path = /var/tmp
   guest ok = No
   printable = Yes
   comment = PDF Generator (only valid users)
   #print command = /usr/share/samba/scripts/print-pdf file path
win_path recipient IP doc_name &
   print command = /usr/share/samba/scripts/print-pdf %s ~%u //%L/%u %m
%I "%J" &

You will see that we backgroud the script (&). We initially (about 2-3
years ago) had the majority of the script in the smb.conf file, but it
was becoming unmanageable, so I wrote the script, which also allowed me
to background the job, instead of manually setting all the windows
machines not to spool the job (which is the other option to prevent them
blocking). Our current print server is not the fastest machine, so it is
an issue for us (ps2pdf on a 50-page document with images will take more
than a few seconds).

Lets just make sure we are comparing the same things. Here is the
current print-pdf script:
http://cvs.samba.org/cgi-bin/cvsweb/samba/packaging/Mandrake/samba-print-pdf.sh?rev=1.1.2.3&content-type=text/x-cvsweb-markup&only_with_tag=SAMBA_2_2

This is the page the other poster referenced:
http://www.linuxgazette.com/issue72/bright.html

Improvements:
1)Use of features such as mktemp to prevent clobbering of other files.
This is not totally correct as I have used it, but I see no other way
when wanting to be able to provide both Postscript and PDF files (which
can be disabled in the script by changing KEEP_PS=1 to KEEP_PS=0). But
the current method will at least prevent the script clobbering itself,
even if two users submit jobs simultaneously.
2)Ensure the user will be able to get the file on a default
installation, so stick it in their home directory
3)Optionally use the document name as the name of the PDF (if the 6th
argument is provided). This can be broken by windows apps sending bad
names, so take out the 6th ("%J") argument in the config file if it does
not work for you.
4)Enforcing good permissions on all versions of the file to ensure that
possibly confidential documents may be readable by others. Admins should
adjust the PERMS variable to be suitable for their environment.
5)Notify the user where their PDF is located via a windows "popup".
Other alternatives are to send an email notification, or to send the PDF
as an attachment, but this would not then work out-the-box without
requiring an MTA to be configured etc.
6)Use better options for PDFs. The current options basically produce
Acrobat 4-style PDFs, adjust via the ps2pdf command used (ps2pdf14 is
Acrobat 5). Pass some other options via OPTIONS. Defaults enable image
compression.

So, in the end, as long as user authentication is used and correclty
setup (ie 'smbpasswd -a <user>'), this will work out-the-box, and
windows users will get a popup notification, hopefully with the document
name as the filename.

Note that is has been a while since I looked at the script in detail,
there still seem to be some things that could be cleaned up, but I am
quite pressed for time these days.

Patches welcome though!

Buchan

- --
|--------------Another happy Mandrake Club member--------------|
Buchan Milne                Mechanical Engineer, Network Manager
Cellphone * Work            +27 82 472 2231 * +27 21 8828820x121
Stellenbosch Automotive Engineering         http://www.cae.co.za
GPG Key                   http://ranger.dnsalias.com/bgmilne.asc
1024D/60D204A7 2919 E232 5610 A038 87B1 72D6 AC92 BA50 60D2 04A7
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+XkQ7rJK6UGDSBKcRAlk4AJ9+EZa/cL8f1jg+cbMD1KYCHcm3swCgxTry
S5rK90xkH6zuaPnu156R8cY=
=1PbE
-----END PGP SIGNATURE-----



More information about the samba mailing list