close

Linux PDF printer driver


Here's something I've done in my linux-box ; so I have a printer named "pdf", and if I choose it, a pdf-file is created in my home-directory with a name based on the current date. Maybe you'll have to adapt it, and you must of course have a ghostcript version with the output-device pdfwrite available (try "gs --help | grep pdfwrite"). Most applications with a GUI give a menu where you can select the name of the printer.

 

  
new section in /etc/printcap/
####################################################################
pdf:
:sd=/var/spool/lpd/pdf:
:mx#0:
:sh:
:lp=/dev/null:
:if=/var/spool/lpd/pdf/filter:
####################################################################
the input filter /var/spool/lpd/pdf/filter :


#!/bin/bash
# set > /tmp/print_env.txt #only for debugging
HOME="/home/$USER"
OUTPUT_FILE=$(date +%x-%X | tr / .).pdf
/usr/bin/gs -dNOPAUSE -q -sDEVICE=pdfwrite -sPAPERSIZE=a4
-sOutputFile="$HOME/$OUTPUT_FILE" -

(last 2 lines on the same line, in fact!)



arrow
arrow
    全站熱搜

    Bluelove1968 發表在 痞客邦 留言(0) 人氣()