1 AUTHOR: Thomas de Roo <thomas@de-roo.org>
7 LICENSE: GNU Free Documentation License
11 Install a PDF-printer using CUPS and Ghostscript
15 This hint describes how you can install a PDF-printer on your (B)LFS-system.
19 http://download.adobe.com/pub/adobe/printerdrivers/win/all/ppdfiles/adobe.zip
23 This hint assumes you have already
33 - Download ans install the Adobe PostScript Printer Description-files:
34 wget http://download.adobe.com/pub/adobe/printerdrivers/win/all/ppdfiles/adobe.zip
36 sudo cp Adobe/ADIST5.PPD /usr/share/cups/model/distiller.ppd
39 sudo mkdir /usr/lib/cups/pdf
40 sudo ln -s /usr/bin/ps2pdfwr /usr/lib/cups/pdf/ps2pdf.cups
44 cat > /usr/lib/cups/backend/pdf << "EOF"
48 PDFBIN=/usr/lib/cups/pdf/ps2pdf.cups
50 # filename of the PDF File
51 PRINTTIME=`date +%Y-%m-%d_%H.%M.%S`
52 # no argument, prints available URIs
54 if [ ! -x "$PDFBIN" ]; then
57 echo "direct pdf \"Unknown\" \"PDF Creator\""
60 # case of wrong number of arguments
61 if [ $# -ne 5 -a $# -ne 6 ]; then
62 echo "Usage: pdf job-id user title copies options [file]"
65 # get PDF directory from device URI, and check write status
66 PDFDIR=${DEVICE_URI#pdf:}
67 if [ ! -d "$PDFDIR" -o ! -w "$PDFDIR" ]; then
68 echo "ERROR: directory $PDFDIR not writable"
71 # generate output filename
73 if [ "$3" = "" ]; then
74 OUTPUTFILENAME="$PDFDIR/unknown.pdf"
76 if [ "$2" != "" ]; then
77 OUTPUTFILENAME="$PDFDIR/$2-$PRINTTIME.pdf"
79 OUTPUTFILENAME="$PDFDIR/$PRINTTIME.pdf"
81 echo "PDF file: $OUTPUTFILENAME placed in: $PDFDIR" >> $LOGFILE
85 $PDFBIN $6 $OUTPUTFILENAME >& /dev/null
87 $PDFBIN - $OUTPUTFILENAME >& /dev/null
93 sudo chmod 755 /usr/lib/cups/backend/pdf
95 - Create the printer in CUPS:
96 (You can choose another path for /tmp, where the PDFs will be saved.)
97 sudo /usr/sbin/lpadmin -p PDF -v pdf:/tmp -E -P /usr/share/cups/model/distiller.ppd
100 sudo /etc/rc.d/init.d/cups restart
102 Now you have a printer "PDF" that writes its output to the /tmp directory.
107 Based on http://www.linuxquestions.org/linux/answers/Applications_GUI_Multimedia/Setting_up_a_PDF_printer_in_CUPS_in_my_case_in_Slackware