Mac PDFWriter Printer

You are viewing an old version (v. 8) of this page.
The latest version is v. 21, last edited on Jul 27, 2009 (view differences | )
<< View previous version | view page history | view next version >>

Postscript / PDF Printer su mac

su mac e' possibile creare una stampante virtuale che stampi su file in formato pdf.

aprire una shell.

portarsi nel folder:

cd /usr/libexec/cups/backend

creare il file PDF con il seguante comando:

sudo touch PDF

nel file PDF aggingere le istruzioni del seguente script di shell:

#!/bin/sh
#
# Michael Goffioul
# Updated by P T Withington for Mac OS X
# Updated by Richard Bronosky
# Updated by Steve Palm (N9YTY) - case insensitive URI, unique output files

LOGFILE=/tmp/PDF.log
GSBIN=/usr/bin/pstopdf
FILENAME=

echo "Script:           $0" > $LOGFILE
echo "Executable:       $GSBIN" >> $LOGFILE
echo "job:              $1" >> $LOGFILE
echo "user:             $2" >> $LOGFILE
echo "title:            $3" >> $LOGFILE
echo "num-copies:       $4" >> $LOGFILE
echo "options:          $5" >> $LOGFILE
echo "filename:         $6" >> $LOGFILE

# case of no argument, prints available URIs
if [ $# -eq 0 ]; then
  if [ ! -x "$GSBIN" ]; then
    exit 0
  fi
  echo "direct PDF \"Unknown\" \"PDF Writing\""
  echo "direct PDF \"Unknown\" \"PDF Writing\"" >> $LOGFILE
  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]"
  echo "Usage: PDF job-id user title copies options [file]" >> $LOGFILE
  exit 1
fi

# get PDF directory from device URI, and check write status
URI_PRE=`echo $DEVICE_URI | cut -c 1-3 | tr "[a-z]" "[A-Z]"`
URI_BODY=`echo $DEVICE_URI | cut -c 4-`
DEVICE_URI="${URI_PRE}${URI_BODY}"
echo "Device URI: $DEVICE_URI" >> $LOGFILE

PDFDIR=${DEVICE_URI#PDF:}
if [ `echo $PDFDIR|cut -c1-3` = //~ ]; then
  PDFDIR=/Users/$2`echo $PDFDIR|cut -c4-`
  # This step added by Richard Bronosky to allow referencing the users home directory
fi
if [ ! -d "$PDFDIR" -o ! -w "$PDFDIR" ]; then
  echo "ERROR: directory $PDFDIR not writable"
  echo "ERROR: directory $PDFDIR not writable" >> $LOGFILE
  exit 1
fi

echo "PDF directory:    $PDFDIR" >> $LOGFILE

# generate output filename
OUTPUTFILENAME=
if [ "$3" = "" ]; then
  OUTPUTFILENAME="$PDFDIR/unknown.PDF"
else
  OUTPUTFILENAME="$PDFDIR/${3//[^[:alnum:]]/_}.PDF"
fi

FBASE=`basename ${OUTPUTFILENAME} .PDF`
typeset -i I=1
while [ -e $OUTPUTFILENAME ]
do
   OUTPUTFILENAME="${PDFDIR}/${FBASE}_$I.PDF"
   I=$I+1
done

echo "Output file name: $OUTPUTFILENAME" >> $LOGFILE

# run ghostscript
if [ $# -eq 6 ]; then
  $GSBIN $6 -o $OUTPUTFILENAME -l /tmp/pdflogfile.log >> $LOGFILE
else
  $GSBIN -i -o $OUTPUTFILENAME -l /tmp/pdflogfile.log >> $LOGFILE
fi

# modify ownership and permissions on the file
#  - world readable
#  - owns to user specified in argument
chmod a+r $OUTPUTFILENAME
if [ "$2" != "" ]; then
  chown $2 $OUTPUTFILENAME
fi

exit 0

andare nell preferenze di sistema

aprire la configurazione delle stampanti e dei fax

aggingere il bottone avanzate

dopo averlo aggiunto premere il bottone delle impostazioni avanzate

impostare i valori come in figura

PDF://~/Documents/print

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.