I finally got postscript printing to work on my recently acquired
Laserjet III (it's an antique for sure but it works just fine).
I could have saved myself a lot of grief had I only realized that
the -sOutputFIle=/dev/fd/3 ghostscript setting had _nothing_ to do
with floppy drives! I had thought the sample script was writing to
a floppy for testing purposes and changed it to "-" : silly me.
Anyways, I've got things working but I'd really like to know what
the "3" is all about. I read fd(4) which says 3-19 are "user-defined";
so where is it being defined here ?
#!/bin/sh
#
# ifhp - Print Ghostscript-simulated PostScript on a HP LaserJet III
# Installed in /usr/local/libexec/ifhp
# Based of sample script from the FreeBSD Handbook
#
# Treat LF as CR+LF:
#
printf "\033&k2G" || exit 2
#
# Read first two characters of the file
#
IFS=""
read -r first_line
first_two_chars=`expr "$first_line" : '\(..\)'`
if [ "$first_two_chars" = "%!" ]; then
#
# It is PostScript; use Ghostscript to scan-convert and print it.
#
# Note that PostScript files are actually interpreted programs,
# and those programs are allowed to write to stdout, which will
# mess up the printed output. So, we redirect stdout to stderr
# and then make descriptor 3 go to stdout, and have Ghostscript
# write its output there. Exercise for the clever reader:
# capture the stderr output from Ghostscript and mail it back to
# the user originating the print job.
#
exec 3>&1 1>&2
/usr/pkg/bin/gs -dSAFER -dNOPAUSE -dBATCH -dQUIET -sDEVICE=ljet3 \
-sOutputFile=/dev/fd/3 -sLETTERSIZE=letter -_ && exit 0
else
#
# Plain text or HP/PCL, so just print it directly; print a form feed
# at the end to eject the last page.
#
echo "$first_line" && cat && printf "\033&l0H" && exit 0
fi
exit 2
####
-Beaker
--
[ SiMpLe MaChInEs ] --> gopher://beaker.mdns.org
or (via proxy)
http://gopher.floodgap.com/gopher/gw.lite?gopher://beaker.mdns.org:70/1
_______________________________________________
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug