www.LinuxHowtos.org


Written by torgrimt@sysrq.no

You will need to have a working install of samba. For windows you can use the apple laser printers drivers. Use one that has colors and high resolution.

Remeber to credit me if you use this. thanks torgrimt at sysrq.no/

Put this in smb.conf

   [smbpdf]
     comment = PDF Generator
     path = /var/spool/samba
     printable = Yes
     print command = /usr/sbin/pdfprint %s %U %G %m %I %H

And the script to convert the files to pdf... You will have to make the dir spesified in OUTPUTPATH in the users homedir.

   #!/bin/bash
   #convert to pdf
   #$1=spool file $2=uid $3=gid   $4=machinename $5=ip $6=homedir
   FILENAME=pdf-$2-`date +%d%m%H%M%S`.pdf
   OUTPUTPATH=$6/pdfwriter
   echo converting $1 to $FILENAME for $2 of machine $4... $6>>
 $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 $6/$FILENAME >> $OUTPUTPATH/pdfcreate.log
   chmod 700 $6/$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

back