Discussion:
[Samba] PDF Printer issue
Robert Adkins II
2003-12-01 18:58:00 UTC
Permalink
Hello Everyone,

I have a slight issue with configuring a PDF printer on my Samba
servers. I have input the following into my smb.conf file and it does
create the printer as well as work to create PDF files, except that it
only functions when "printing" to that printer via Excel 2002. If I
attempt it with anything else, even the Windows Test print, it fails.

Now, in the Windows Printers folder, if I select the PDF printer
the status box states that the printer is inactive and not ready.
However, if I browse to the printer through the Windows Explorer Network
Neighborhood, the printer shows up as active and ready.

I am unsure quite what the problem is, which means it is likely
something very easy. There is one thing to note, I have not a single
Linux Printing Subsystem running on the machine as this server is not
being used for regular printing of any sort.

Here is my smb.conf section:


[purchpdf]
comment = PDF Generator for Purchasing
path = /var/spool/samba
valid users = *UserNames Removed*
write list = *UserNames Removed*
printable = yes
print command = gs -dNOPAUSE -dbatch -q -sDEVICE=pdfwrite
-sOutputFile=/share/purchasing/pdf/%J.pdf <%J 1>/dev/null 2>&1; rm -f %J

Thanks for any assistance that can be rendered.

Regards,
Robert Adkins II
IT Manager/Buyer
Impel Industries, Inc.
586-254-5800
Martin Thomas
2003-12-01 18:58:13 UTC
Permalink
:
: Hello Everyone,
:
: I have a slight issue with configuring a PDF printer on my Samba
: servers. I have input the following into my smb.conf file and it does
: create the printer as well as work to create PDF files, except that it
: only functions when "printing" to that printer via Excel 2002. If I
: attempt it with anything else, even the Windows Test print, it fails.
:
: Now, in the Windows Printers folder, if I select the PDF printer
: the status box states that the printer is inactive and not ready.
: However, if I browse to the printer through the Windows Explorer Network
: Neighborhood, the printer shows up as active and ready.
:
: I am unsure quite what the problem is, which means it is likely
: something very easy. There is one thing to note, I have not a single
: Linux Printing Subsystem running on the machine as this server is not
: being used for regular printing of any sort.
:
: Here is my smb.conf section:
:
:
: [purchpdf]
: comment = PDF Generator for Purchasing
: path = /var/spool/samba
: valid users = *UserNames Removed*
: write list = *UserNames Removed*
: printable = yes
: print command = gs -dNOPAUSE -dbatch -q -sDEVICE=pdfwrite
: -sOutputFile=/share/purchasing/pdf/%J.pdf <%J 1>/dev/null 2>&1; rm -f %J
:
: Thanks for any assistance that can be rendered.
:
: Regards,
: Robert Adkins II
: IT Manager/Buyer
: Impel Industries, Inc.
: 586-254-5800


Robert,

Do you serve the printer-drivers for the workstations from
you Samba-Server? - Of not, set "use client driver" to "yes" for the
"pruchpdf"-printershare (see man smb.conf for details). Consider
serving the driver from Samba (upload it and don't use the
client driver option, see the howto-collection.pdf).
Here we use the driver "Apple Color Laserwriter 12/600"
served from Samba to Windows 2000(sp2,sp3) clients without
problems.

I also had to override the lpq-command. Try to set
"lpq command = /var/samba/lpqdummy.txt" Where lpqdummy.txt
only has one line with the text "no entries". Windows now always
shows "ready".

Take a look into the Mandrake-packaging-dir in the Samba distribution.
(or http://cvs.samba.org/cgi-bin/cvsweb/samba/packaging/Mandrake )
Using their method (see smb.conf and samba-print-pdf.sh) works
better than directly calling gs with "print command". I had some
blocking issues with the direct call and large documents before using
this method.

Martin
Noel Kelly
2003-12-01 18:58:31 UTC
Permalink
Might not be much help but you could try and use 'use client driver = yes'.

Also very nice PDF/Samba Howto here:
http://www.linuxgazette.com/issue72/bright.html

-----Original Message-----
From: Robert Adkins II [mailto:***@impelind.com]
Sent: 24 February 2003 22:09
To: ***@lists.samba.org
Subject: [Samba] PDF Printer issue


Hello Everyone,

I have a slight issue with configuring a PDF printer on my Samba
servers. I have input the following into my smb.conf file and it does
create the printer as well as work to create PDF files, except that it
only functions when "printing" to that printer via Excel 2002. If I
attempt it with anything else, even the Windows Test print, it fails.

Now, in the Windows Printers folder, if I select the PDF printer
the status box states that the printer is inactive and not ready.
However, if I browse to the printer through the Windows Explorer Network
Neighborhood, the printer shows up as active and ready.

I am unsure quite what the problem is, which means it is likely
something very easy. There is one thing to note, I have not a single
Linux Printing Subsystem running on the machine as this server is not
being used for regular printing of any sort.

Here is my smb.conf section:


[purchpdf]
comment = PDF Generator for Purchasing
path = /var/spool/samba
valid users = *UserNames Removed*
write list = *UserNames Removed*
printable = yes
print command = gs -dNOPAUSE -dbatch -q -sDEVICE=pdfwrite
-sOutputFile=/share/purchasing/pdf/%J.pdf <%J 1>/dev/null 2>&1; rm -f %J

Thanks for any assistance that can be rendered.

Regards,
Robert Adkins II
IT Manager/Buyer
Impel Industries, Inc.
586-254-5800
--
To unsubscribe from this list go to the following URL and read the
instructions: http://lists.samba.org/mailman/listinfo/samba
Buchan Milne
2003-12-01 18:58:32 UTC
Permalink
Date: Thu, 27 Feb 2003 08:50:12 -0000
Subject: RE: [Samba] PDF Printer issue
Content-Type: text/plain;
charset="iso-8859-1"
MIME-Version: 1.0
Precedence: list
Message: 8
Might not be much help but you could try and use 'use client driver = yes'.
Better to install a driver on the samba server.
http://www.linuxgazette.com/issue72/bright.html
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.

BTW, Mandrake 9.0 and later have a working pdf converter out-the-box
(just need to upload a printer driver).

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
Chris Smith
2003-12-01 18:58:34 UTC
Permalink
Post by Buchan Milne
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.
Buchan Milne
2003-12-01 18:58:34 UTC
Permalink
Post by Chris Smith
Post by Buchan Milne
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
Florian Stahl
2003-12-01 18:58:35 UTC
Permalink
Hi list,

I have stepped over this description for Printing from Windows into PDF
files.
Post by Buchan Milne
Post by Noel Kelly
http://www.linuxgazette.com/issue72/bright.html
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.
BTW, Mandrake 9.0 and later have a working pdf converter out-the-box
(just need to upload a printer driver).
Buchan
my /etc/samba/smb.conf has this section for it (Samba 2.2.1)

[pdf]
path = /tmp/spool
printable = yes
guest ok = yes
print command = /var/space/samba/printpdf.sh %s %J %c %z %f
lpq command =
lprm command =

(I know the %J %c %z %f is bogus, I was trying to figure the document name)

Everything works fine as far as I start printing larger files - a Word
document containing 150 pages text (NO graphics!), I get only partial
results, a random part of pages of the original document.

It seems that my W2K client, whatever option I tried in the Printer Driver
Properties, starts spoolsv.exe to spool print data - that causes smbd to
swallow resources heavily (50 %) until spoolsv.exe finishes, and then cuts
off the rest of the data.

I have tried many different postscript drivers, including those with Large
Memory defaults for their machines, and every option in their properties
(i.e. dont use spooler, pass straight to printer etc).

I pretty much believe its a W2K issue, if I use the above SHARE-section
[pdf]
with "print command = ", I can print a 600 pages document, but of course
straight
to happy virtual hunting grounds...

Any suggestions would be highly appreciated.


Florian
(***@xantury.com)
Florian Stahl
2003-12-01 18:58:42 UTC
Permalink
Hi list,

a beginning samba user's learning experience
in the audiences highly regarded interest is as follows :-) :

- Buchan's script from mandrake works pretty nicely and
set me on the right path.

- I even managed to put my own solution without the described trouble as
well:
the issue is (so below) not stating these lpq and lprm commands.
stating the print command with a ending '&' gives Client resources free
before ps2pdf finishes the PDF file...

print command = /var/space/samba/printpdf.sh %s &

thanks again

florian
Post by Florian Stahl
Hi list,
I have stepped over this description for Printing from
Windows into PDF
files.
Post by Buchan Milne
Post by Noel Kelly
http://www.linuxgazette.com/issue72/bright.html
The script in packaging/Mandrake/print-pdf (or something
like that) is
Post by Buchan Milne
IMHO a better solution. I can expand as to why if you are
interested.
Post by Buchan Milne
BTW, Mandrake 9.0 and later have a working pdf converter out-the-box
(just need to upload a printer driver).
Buchan
my /etc/samba/smb.conf has this section for it (Samba 2.2.1)
[pdf]
path = /tmp/spool
printable = yes
guest ok = yes
print command = /var/space/samba/printpdf.sh %s %J %c %z %f
lpq command =
lprm command =
(I know the %J %c %z %f is bogus, I was trying to figure the
document name)
Everything works fine as far as I start printing larger files - a Word
document containing 150 pages text (NO graphics!), I get only partial
results, a random part of pages of the original document.
Loading...