[Samba] PDF Samba Printer - ps2pdf Only Letter Size?

Wolfram Quester wquester at mittelerde.physik.uni-konstanz.de
Thu May 15 15:52:01 GMT 2003


Hi Matthew,


On Thu, May 15, 2003 at 04:09:39PM +0930, Matthew Western wrote:
> Hi all,
> 
> I've got a nice working pdf samba printer emailing the right person thanks to PeteFwee and David F and am doing a little testing. I've just realized that it's set to Letter when it creates the .pdf file. and i've googled till i'm blue in the face and can't see any options that says page size or something similar. i'm running ghostscript 7.04.

I agree it's quite hard to find. if you do man ps2pdf you can read

> SEE ALSO
>        gs(1), ps2pdfwr(1),
>        Ps2pdf.htm in the Ghostscript documentation
       
In Ps2pdf.htm you find that it understands all options from gs(1), so you
have to do man gs(1), where you can read

> To select a specific paper size, use the command line switch
> 	-sPAPERSIZE=a_known_paper_size
> for instance
> 	-sPAPERSIZE=a4
> or
> 	-sPAPERSIZE=legal

<...snip...>
> 
> # Copyright (C) Michael Goffioul (goffioul at imec.be) 2001
> 
> LOGFILE=/var/log/cups/pdf.log
> 
> PDFBIN=`which ps2pdf`

Please correct me, if I'm wrong, but I thought one of the purposes of variables
like these is to prevent scripts from executing binaries provided by the
user. These binaries can do things not intended by the original author of 
the script. Your method to initialize the PDFBIN variable does not
ensure this prevention. To make sure the script uses the correct ps2pdf
you should use the absolute path.

I'm not seeing where you call ps2pdf in your script and mail it back to
the user. Is it just for testing purposes or a script running before
another one?

Best regards,

Wolfi

> 
> FILENAME= 
> 
> # this is borrowed from printpdf script for the filename
> 
> PRINTTIME=`date +%b%d-%H%M%S`
> 
> echo "Executable: $PDFBIN" >> $LOGFILE
> 
> echo "Arguments: |$1|$2|$3|$4|$5|$6|" >> $LOGFILE 
> 
> echo $# $PRINTTIME >> $LOGFILE
> 
> # case of no argument, prints available URIs
> 
> if [ $# -eq 0 ]; then
> 
> if [ ! -x "$PDFBIN" ]; then
> 
> exit 0
> 
> fi
> 
> echo "direct pdf \"Unknown\" \"PDF Writing\""
> 
> exit 0
> 
> fi 
> 
> # case of wrong number of arguments
> 
> if [ $# -ne 5 -a $# -ne 6 ]; then
> 
> echo "Usage: pdf job-id user title copies options [file]"
> 
> exit 1
> 
> fi 
> 
> # get PDF directory from device URI, and check write status
> 
> PDFDIR=${DEVICE_URI#pdf:}
> 
> if [ ! -d "$PDFDIR" -o ! -w "$PDFDIR" ]; then
> 
> echo "ERROR: directory $PDFDIR not writable"
> 
> exit 1
> 
> fi 
> 
> echo "PDF directory: $PDFDIR" >> $LOGFILE 
> --
> 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