3 # This is a script which allows you to set up a virtual printer on samba
4 # which will take the file (generated by a postscript filter on windows)
5 # and turn it into a PDF, informing the user of where it is when it
8 # Buchan Milne <bgmilne@cae.co.za> 20020723
11 # $1 = file (usually passed with %s from samba)
12 # $2 = unix prefix to where to place the file (~%u should work)
13 # $3 = windows prefix to the same location (\\%L\%u should work)
14 # $4 = user/computer to send a notification to (%u or %m)
15 # $5 = IP address of client (%I)
19 OPTIONS
="-dAutoFilterColorImages=false -sColorImageFilter=FlateEncode"
23 INFILE
=$
(basename $INPUT)
26 #make a temp file to use for the output of the PDF
27 OUTPUT
=`mktemp -q $2/$BASEFILE-XXXXXX`
29 echo "$0: Can't create temp file $2/$BASEFILE-XXXXXX, exiting..."
33 WIN_OUTPUT
="$3\\`basename $OUTPUT`"
36 $PS2PDF $OPTIONS $INPUT $OUTPUT.pdf
>/dev
/null
2>&1
38 # Generate a message to send to the user, and deal with the original file:
39 MESSAGE
=$
(echo "Your PDF file has been created as $WIN_OUTPUT.pdf\n")
43 MESSAGE
=$
(echo "$MESSAGE and your postscript file as $WIN_OUTPUT.ps")
44 # Fix permissions on the generated files
45 chmod $PERMS $OUTPUT.ps
48 chmod $PERMS $OUTPUT.ps
$OUTPUT.pdf
49 # Fix permissions on the generated files
52 chmod $PERMS $OUTPUT.ps
$OUTPUT.pdf
54 #Remove empty file from mktemp:
57 # Send notification to user
58 echo -e $MESSAGE|smbclient
-M $4 -I $5 -U "PDF Generator" >/dev
/null
2>&1