PDF Create Script for Samba Printer

Matthew Western mwestern at affairs.net.au
Thu May 15 09:26:00 CST 2003


Hi All,
I've got a working samba printer to pdf and used the sample script from
http://www.linuxgazette.com/issue72/bright.html  and am trying to modify it
so the pdf created at the end is the same as the job name submitted by the
person.   I've got it as far as the job name getting through but it chops
the filename at the space which didn't really surpise me.  the man page
tells me that %J is the job name.

Anybody a whiz with these scripts can help me out?
-----smb.conf
[pdf]
        comment = PDF Printer
        path = /etc/samba/pdfoutput
        public = yes
        writeable = yes
        printable = yes
        print command = /etc/samba/pdfwrite.sh %s %J
        lpq command =
        lprm command =
-----pdfwrite.sh

#!/bin/sh

# Simple script to convert a specified postscript file into a PDF document
# and place it in a location that is shared by the Samba server.
#
# Arguments:
#   1st - The name of the spool file
#
# John Bright, 2001, jbright at winfordeng.com

# We will create the pdf into a temporary file based upon the current date
and time.
# After we are finished, we'll rename it to a file with the same date, but
ending
# in .pdf.  We do this because if a user tries to open a PDF that is still
being written,
# they will get a message that it is corrupt, when it is actually just not
done yet.

DATE=`date +%b%d-%H%M%S`

# Directory in which to place the output
# Be sure this directory exists and is writable by the user that Samba
# is running as (for example, the nobody user)
OUTDIR=/etc/samba/pdfoutput

#ps2pdf $1 $OUTDIR/$DATE.temp
#mv $OUTDIR/$DATE.temp $OUTDIR/$DATE.pdf
#rm $1

ps2pdf $1 $OUTDIR/$1.temp
cp $OUTDIR/$1.temp $OUTDIR/$2.pdf

#rm $1

-- 
LinuxSA WWW: http://www.linuxsa.org.au/ IRC: #linuxsa on irc.freenode.net
To unsubscribe from the LinuxSA list:
  mail linuxsa-request at linuxsa.org.au with "unsubscribe" as the subject



More information about the linuxsa mailing list