Hi all, Thought I'd post this to the list as I found a better way of doing it. Nice to have for posterity. Please include it in the source of samba if you wish - I hereby license it under GPL 1. install ghostscript (most distributions include it anyway) 2. put the following in the file /usr/sbin/pdfprint and make it executable by whatever your guest user for samba is : #!/bin/bash #convert to pdf $1 = spool file $2 = uid $3 = gid $4 = machinename $5 = ip FILENAME=pdf-$2-`date +%d%m%H%M%S`.pdf OUTPUTPATH=/mnt/raid/topdf echo converting $1 to $FILENAME for $2 of machine $4... >> $OUTPUTPATH/pdfcreate.log /usr/bin/ps2pdf $1 $OUTPUTPATH/$FILENAME >> $OUTPUTPATH/pdfcreate.log 2>> $OUTPUTPATH/pdfcreate.log echo conversion finished, removing $1 >> $OUTPUTPATH/pdfcreate.log rm $1 echo done, setting permissions and notifing user >> $OUTPUTPATH/pdfcreate.log chown $2:$3 /mnt/raid/topdf/$FILENAME >> $OUTPUTPATH/pdfcreate.log chmod 700 /mnt/raid/topdf/$FILENAME >> $OUTPUTPATH/pdfcreate.log echo your new PDF is called $FILENAME. | smbclient -M $4 -I $5 echo All done. >> $OUTPUTPATH/pdfcreate.log echo >> $OUTPUTPATH/pdfcreate.log of course the permissions and file format can be altered depending on your system, but make sure that as these files are created by the guest user, that the directories referenced (spool dir and OUTPUTPATH) are writable by nobody (or whatever your guest user is). 3. edit your smb.conf file and add something like the following : [pdfwriter] path = /var/spool/samba guest ok = yes browseable = yes printable = yes read only = no force group = root force user = root force create mode = 0777 print command = /usr/sbin/pdfprint %s %U %G %m %I Yet again, the permissions I have arrived at via trial-and-error and are more than a little insecure :) 4. restart samba root@linuxsambaserver:~# killall -HUP smbd ; killall -HUP nmbd NB this apparently is not the way to do it on anything other than Linux! 5. Assign a postscript printer to the pdfwriter printer - Apple Color LaserWriter 12/600 works well for me on NT4, but Adobe do a free (small F) printer driver, which also works well. 6. Print. You should get a message (NT/2K/XP/9x with winpopup) informing you of the name of your file. Hope this helps someone. Martyn Ranyard Free Software Advocate jabber - joran@amessage.de icq - 122500800 irc - Joran on oftc msn - ranyardm@hotmail.com e - ranyardm@lineone.net
Hi Martyn I'm currently attempting to set up the same kind of thing, however I'm using CUPS as the printing system and it ignores the "print command" parameter. At the moment I have a pdf print share set up, and I can print to it, but the PS file doesn't convert to pdf (I can do it manually from the CL and it comes out fine) I take it you used lpd? Does anyone on the list have pdf writing working with CUPS as the printing system?? TIA>-----Original Message----- >From: Martyn Ranyard [mailto:ranyardm@lineone.net] >Sent: Tuesday, 30 July 2002 12:53 AM >To: Samba List >Subject: [Samba] HOWTO Create a PDF Writer in samba > > > >Hi all, > > Thought I'd post this to the list as I found a better way of doing >it. Nice to have for posterity. > Please include it in the source of samba if you wish - I >hereby license >it under GPL > >1. install ghostscript (most distributions include it anyway) >2. put the following in the file /usr/sbin/pdfprint and make >it executable >by whatever your guest user for samba is : > >#!/bin/bash >#convert to pdf $1 = spool file $2 = uid $3 = gid $4 = >machinename $5 = ip >FILENAME=pdf-$2-`date +%d%m%H%M%S`.pdf >OUTPUTPATH=/mnt/raid/topdf >echo converting $1 to $FILENAME for $2 of machine $4... >> >$OUTPUTPATH/pdfcreate.log >/usr/bin/ps2pdf $1 $OUTPUTPATH/$FILENAME >> >$OUTPUTPATH/pdfcreate.log 2>> >$OUTPUTPATH/pdfcreate.log >echo conversion finished, removing $1 >> $OUTPUTPATH/pdfcreate.log >rm $1 >echo done, setting permissions and notifing user >> >$OUTPUTPATH/pdfcreate.log >chown $2:$3 /mnt/raid/topdf/$FILENAME >> $OUTPUTPATH/pdfcreate.log >chmod 700 /mnt/raid/topdf/$FILENAME >> $OUTPUTPATH/pdfcreate.log >echo your new PDF is called $FILENAME. | smbclient -M $4 -I $5 >echo All done. >> $OUTPUTPATH/pdfcreate.log >echo >> $OUTPUTPATH/pdfcreate.log > >of course the permissions and file format can be altered >depending on your >system, but make sure that as these files are created by the >guest user, >that the directories referenced (spool dir and OUTPUTPATH) are >writable by >nobody (or whatever your guest user is). > >3. edit your smb.conf file and add something like the following : > >[pdfwriter] > path = /var/spool/samba > guest ok = yes > browseable = yes > printable = yes > read only = no > force group = root > force user = root > force create mode = 0777 > print command = /usr/sbin/pdfprint %s %U %G %m %I > >Yet again, the permissions I have arrived at via >trial-and-error and are >more than a little insecure :) > >4. restart samba > >root@linuxsambaserver:~# killall -HUP smbd ; killall -HUP nmbd > >NB this apparently is not the way to do it on anything other >than Linux! > >5. Assign a postscript printer to the pdfwriter printer - Apple Color >LaserWriter 12/600 works well for me on NT4, but Adobe do a >free (small F) >printer driver, which also works well. > >6. Print. You should get a message (NT/2K/XP/9x with >winpopup) informing >you of the name of your file. > >Hope this helps someone. > > >Martyn Ranyard >Free Software Advocate > >jabber - joran@amessage.de >icq - 122500800 >irc - Joran on oftc >msn - ranyardm@hotmail.com >e - ranyardm@lineone.net > > >-- >To unsubscribe from this list go to the following URL and read the >instructions: http://lists.samba.org/mailman/listinfo/samba >
Hi to the list, this is a simple PDFwriter I use: requires Package for ps2pdf installed (assume: ghostview) and a script for sending attachments as email (mail_attachment). It doesn't require lpd/CUPS or whatever unix printer driver installed. Printer driver = Apple Laserwriter. Result = nice colored! PDF Booklet per Email. smb.conf: [pdf] comment = "Ausdruck als PDF per Email" postscript = yes print command = ( ps2pdf %s print_%m_%u.pdf; /usr/bin/mail_attachment -s "Your print job from %m" %u print_%m_%u.pdf; rm print_%m_%u.pdf ) # unique but ugly name: # print command = ( ps2pdf %s %s.pdf; /usr/bin/mail_attachment -s "Your print job from %m" %u %s.pdf; rm %s.pdf ) printable = yes writable = no path = /tmp valid users = @users write list = @users [ps] comment = "Ausdruck als Postscript per Email" postscript = yes print command = ( mv %s print_%m_%u.ps; /usr/bin/mail_attachment -s "Your print job from %m" %u print_%m_%u.ps; rm print_%m_%u.ps ) # unique but ugly name: # print command = ( mv %s %s.ps; /usr/bin/mail_attachment -s "Your print job from %m" %u %s.ps; rm %s.ps ) printable = yes writable = no path = /tmp valid users = @users write list = @users
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 | Message: 16 | Date: Mon, 29 Jul 2002 16:23:10 +0100 | To: Samba List <samba@lists.samba.org> | From: Martyn Ranyard <ranyardm@lineone.net> | Subject: [Samba] HOWTO Create a PDF Writer in samba | | | Hi all, | | Thought I'd post this to the list as I found a better way of doing | it. Nice to have for posterity. | Please include it in the source of samba if you wish - I hereby license | it under GPL | | 1. install ghostscript (most distributions include it anyway) | 2. put the following in the file /usr/sbin/pdfprint and make it executable | by whatever your guest user for samba is : | Well, I just (last week) put a similar one into the Mandrake samba RPMs: http://cvs.mandrakesoft.com/cgi-bin/cvsweb.cgi/SPECS/samba/samba-print-pdf.sh?rev=1.1&content-type=text/x-cvsweb-markup It could also be under the GPL. I reviewed all the comments that were posted in the older thread, and this is the best option I came up with. We use something like this in the smb.conf: [pdfprint] ~ path = /var/tmp ~ guest ok = No ~ printable = Yes ~ comment = PDF Generator ~ print command = /usr/share/samba/scripts/print-pdf %s ~%u Z:\\ %m %I & (& important, as it allows the file to be "spooled", since the smbd doesn't wait for the process to return). Since we write the pdf to their home directory (NFS mounted from our file server), we don't allow guests. It also allows us to set better permissions. | of course the permissions and file format can be altered depending on your | system, but make sure that as these files are created by the guest user, | that the directories referenced (spool dir and OUTPUTPATH) are writable by | nobody (or whatever your guest user is). For convenience, my equivalent is provided by the caller, so the user should only need to modify the smb.conf to change it. | | 3. edit your smb.conf file and add something like the following : | | [pdfwriter] | path = /var/spool/samba | guest ok = yes | browseable = yes | printable = yes | read only = no | force group = root | force user = root | force create mode = 0777 Not a good combo of permisssions/group/user. | print command = /usr/sbin/pdfprint %s %U %G %m %I | | Yet again, the permissions I have arrived at via trial-and-error and are | more than a little insecure :) | | 4. restart samba | | root@linuxsambaserver:~# killall -HUP smbd ; killall -HUP nmbd | | NB this apparently is not the way to do it on anything other than Linux! | | 5. Assign a postscript printer to the pdfwriter printer - Apple Color | LaserWriter 12/600 works well for me on NT4, but Adobe do a free (small F) | printer driver, which also works well. How about uploading the printer driver to your samba server, so the clients can use a downloadable print driver (ie double click on the printer to set it up). | | 6. Print. You should get a message (NT/2K/XP/9x with winpopup) informing | you of the name of your file. | | Hope this helps someone. P.S. For some users, it's handy to have postscript also, so we keep the .ps file. - -- |----------------Registered Linux User #182071-----------------| 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.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE9RsCBrJK6UGDSBKcRAv/wAJ4vV3MjWfdNGTaja1KD1eCmvQNXhgCbBC0f +4iVYfoZaNgc5a3wrc4qUEo=6IJI -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 | Message: 12 | From: "Chris Mason" <masonc@masonc.com> | To: "'Samba List (E-mail)'" <samba@lists.samba.org> | Subject: RE: [Samba] HOWTO Create a PDF Writer in samba | Date: Tue, 30 Jul 2002 05:52:09 -0400 | | Is an "Email attached PDF -to - print" solution possible, where an email | to a certain address containing a pdf will auto print on the printer? | I am thinking about the New York Times fax that comes to us by email and | is the only email we get to that address. Using Redhat 7.3 and a HP | laserjet. | | This is not really related to samba though. You can make a procmail/maildrop/other MDA rule, which will filter that mail, and have it run through a script. We do something similar with reports we get, we strip out the attachments, uudecode them if necessary, unzip if necessary and dump the ~ file. Here is an example script you can look at (takes file on stdin, ie from procmail filter): http://ranger.dnsalias.com/mandrake/scripts/fileeater You can then just add pdf2ps|lpr on any .pdf attachment. Buchan - -- |----------------Registered Linux User #182071-----------------| 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.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE9RsL3rJK6UGDSBKcRAvY/AJ4ypdWPQpI0W4iwgh/d0s/HGn9QLQCeOEhF jarP4DjH5G5oZqypKhOPELM=lQ/L -----END PGP SIGNATURE-----
>Maybe this is a bug, because according to the man page the >generic print >command = {whatever} should only override the printers that >don't have a >print command = {whatever} set specifically, what version of >samba are you >using?I'm using 2.2.5 on Redhat 7.3. I figured the same thing after reading the man page, so I was kind of surprised when the pdf conversion didn't work and all I was left with was the spool file in the share (which converted fine with ps2pdf from the command line). I have a couple of things to try, if worst comes to worst then I'll change back to LPRng, which I'd prefer not to do as I like the administration features of CUPS.