h1. Postscript / PDF Printer su mac
su mac e' possibile creare una stampante virtuale che stampi su file in formato pdf.
aprire una shell.
!Immagine 15.png|align=center!
portarsi nel folder:
{panel}
*_cd /usr/libexec/cups/backend_*
{panel}
creare il file PDF con il seguante comando:
{panel}
*_sudo touch PDF_*
{panel}
modificare le permission del file PDF con il comando
{panel}
*_sudo chmod 755 ./PDF_*
{panel}
aprire il file PDF con il comando vi:
{panel}
*_sudo vi ./PDF_*
{panel}
nel file PDF aggingere il seguente script di shell:
{noformat}
#!/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
{noformat}
creare la cartella print sotto il folder Documents
{panel}
mkdir ~/Documents/print
{panel}
dare le permission di scrittura su questa cartella
{panel}
chmod 777 ~/Documents/print
{panel}
andare nelle preferenze di sistema
!Immagine 5.png|align=center!
aprire la configurazione delle stampanti: "stampa e fax":
!Immagine 6.png|align=center!
premere il simbolo "+" per aggiungere una nuova stampante
se fra i bottoni della barra degli strumenti non non trovate le impostazioni avanzate bisogna customizzare la toolbar
premere il bottone dx del mouse sulla barra degli strumenti e scegliere personalizza barra degli strumenti ed aggingere il bottone avanzate
!Immagine 7.png|align=center!
!Immagine 8.png|align=center!
ora entrare nelle impostazioni avanzate facendo click sul bottone avanzate:
ed impostare i valori come in figura
!Immagine 9.png|align=center!
!Immagine 11.png|align=center!
i valori inseriti sono:
{panel}
Tpo=PDF Writing
Dispositivo=Un altro Dispositivo
URL=PDF://~/Documents/print
Nome=PDFWriter
Posizione=
Stampa con=Stampante PostScript generica
{panel}
premere sul bottone aggiungi
la configurazione della stampante virtuale e' ora completa.
questa stampante risulta visibile nelle virtual machine Fusion. se non lo fosse verificare le impostazioni di fusion:
!Immagine 13.png|align=center!
la stampante PDFWriter e' quindi utilizzabile per stampare i documenti da windows in formato pdf.
!Immagine 12.png|align=center!
i documenti stampati, ovvero i file pdf si trovano nel path:
{panel}
~/Documents/print
{panel}
visibile nel finder:
!Immagine 14.png|align=center!
su mac e' possibile creare una stampante virtuale che stampi su file in formato pdf.
aprire una shell.
!Immagine 15.png|align=center!
portarsi nel folder:
{panel}
*_cd /usr/libexec/cups/backend_*
{panel}
creare il file PDF con il seguante comando:
{panel}
*_sudo touch PDF_*
{panel}
modificare le permission del file PDF con il comando
{panel}
*_sudo chmod 755 ./PDF_*
{panel}
aprire il file PDF con il comando vi:
{panel}
*_sudo vi ./PDF_*
{panel}
nel file PDF aggingere il seguente script di shell:
{noformat}
#!/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
{noformat}
creare la cartella print sotto il folder Documents
{panel}
mkdir ~/Documents/print
{panel}
dare le permission di scrittura su questa cartella
{panel}
chmod 777 ~/Documents/print
{panel}
andare nelle preferenze di sistema
!Immagine 5.png|align=center!
aprire la configurazione delle stampanti: "stampa e fax":
!Immagine 6.png|align=center!
premere il simbolo "+" per aggiungere una nuova stampante
se fra i bottoni della barra degli strumenti non non trovate le impostazioni avanzate bisogna customizzare la toolbar
premere il bottone dx del mouse sulla barra degli strumenti e scegliere personalizza barra degli strumenti ed aggingere il bottone avanzate
!Immagine 7.png|align=center!
!Immagine 8.png|align=center!
ora entrare nelle impostazioni avanzate facendo click sul bottone avanzate:
ed impostare i valori come in figura
!Immagine 9.png|align=center!
!Immagine 11.png|align=center!
i valori inseriti sono:
{panel}
Tpo=PDF Writing
Dispositivo=Un altro Dispositivo
URL=PDF://~/Documents/print
Nome=PDFWriter
Posizione=
Stampa con=Stampante PostScript generica
{panel}
premere sul bottone aggiungi
la configurazione della stampante virtuale e' ora completa.
questa stampante risulta visibile nelle virtual machine Fusion. se non lo fosse verificare le impostazioni di fusion:
!Immagine 13.png|align=center!
la stampante PDFWriter e' quindi utilizzabile per stampare i documenti da windows in formato pdf.
!Immagine 12.png|align=center!
i documenti stampati, ovvero i file pdf si trovano nel path:
{panel}
~/Documents/print
{panel}
visibile nel finder:
!Immagine 14.png|align=center!