3 # Printer filter for postscript or plain text with output to a HP laserjet.
4 # This requires two packages to be installed:
6 # /usr/pkgsrc/print/ghostscript
7 # /usr/pkgsrc/print/enscript
9 # lp|ps|local line printer:\
11 # :lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:\
12 # :if=/usr/local/libexec/if-gs-ljet4:
14 # $DragonFly: src/share/examples/printing/if-gs-ljet4,v 1.1 2006/08/15 16:21:23 dillon Exp $
17 first_two_chars=`expr "$first_line" : '\(..\)'`
19 if [ "$first_two_chars" = "%!" ]; then
21 # PostScript job, print it.
23 (echo "$first_line" && cat && exit 0) | \
24 gs -q -sPAPERSIZE=letter -sDEVICE=ljet4 -sOutputFile=%stdout% -
29 # Plain text, convert it, then print it.
31 ( echo "$first_line"; cat ) | /usr/pkg/bin/enscript -G | \
32 gs -q -sPAPERSIZE=letter -sDEVICE=ljet4 -sOutputFile=%stdout% -