[Samba] HOWTO Create a PDF Writer in samba

Chris Mason masonc at masonc.com
Tue Jul 30 02:54:02 GMT 2002

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


-----Original Message-----
From: samba-admin at lists.samba.org [mailto:samba-admin at lists.samba.org]
On Behalf Of Freeman, Peter (ERHS)
Sent: Tuesday, July 30, 2002 12:27 AM
To: Martyn Ranyard
Cc: Samba List (E-mail)
Subject: RE: [Samba] HOWTO Create a PDF Writer in samba

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
from the CL and it comes out fine)

I take it you used lpd?  Does anyone on the list have pdf writing
with CUPS as the printing system??


>-----Original Message-----
>From: Martyn Ranyard [mailto:ranyardm at 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 :
>#convert to pdf $1 = spool file $2 = uid $3 = gid $4 = 
>machinename $5 = ip
>FILENAME=pdf-$2-`date +%d%m%H%M%S`.pdf
>echo converting $1 to $FILENAME for $2 of machine $4... >> 
>/usr/bin/ps2pdf $1 $OUTPUTPATH/$FILENAME >> 
>$OUTPUTPATH/pdfcreate.log 2>> 
>echo conversion finished, removing $1 >> $OUTPUTPATH/pdfcreate.log
>rm $1
>echo done, setting permissions and notifing user >> 
>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 :
>         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 at 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 at amessage.de
>icq    - 122500800
>irc    - Joran on oftc
>msn    - ranyardm at hotmail.com
>e      - ranyardm at lineone.net
>To unsubscribe from this list go to the following URL and read the
>instructions:  http://lists.samba.org/mailman/listinfo/samba

To unsubscribe from this list go to the following URL and read the
instructions:  http://lists.samba.org/mailman/listinfo/samba

More information about the samba mailing list