3 # Printer filter for postscript or plain text with output to a HP laserjet.
4 # This requires two packages to be installed:
6 # /usr/dports/print/ghostscript9 (or later)
7 # /usr/dports/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:
15 first_two_chars
=`expr "$first_line" : '\(..\)'`
17 if [ "$first_two_chars" = "%!" ]; then
19 # PostScript job, print it.
21 (echo "$first_line" && cat && exit 0) | \
22 gs
-q -sPAPERSIZE=letter
-sDEVICE=ljet4
-sOutputFile=%stdout
% -
27 # Plain text, convert it, then print it.
29 ( echo "$first_line"; cat ) |
/usr
/local
/bin
/enscript
-G | \
30 gs
-q -sPAPERSIZE=letter
-sDEVICE=ljet4
-sOutputFile=%stdout
% -