Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 May 1997 22:47:02 +0100
From:      Lee Johnston <ljohnston@cyberworld.demon.co.uk>
To:        questions@freebsd.org
Subject:   Printing using FreeBSD
Message-ID:  <33821BD5.BC4BBF04@cyberworld.demon.co.uk>

next in thread | raw e-mail | index | archive | help
I am using FreeBSD 2.1.6 with a non postscript printer (a Canon BJC-4100

Bubble Jet simulating a Epson LQ). I have managed to get ghostscript to
printout a .ps file on the printer, but when I create a printer filter
that is included in the FreeBSD handbook, which is shown below, it
doesn't work!

#!/bin/sh
#
#  ifhp - Print Ghostscript-simulated PostScript on a Canon BJC-4100
#  Installed in /usr/local/libexec/hpif
#
#  Treat LF as CR+LF:
#
printf "\033&k2G" || exit 2
#
#  Read first two characters of the file
#
read first_line
first_two_chars=`expr "$first_line" : '\(..\)'`
if [ "$first_two_chars" = "%!" ]; then
    #
    #  It is PostScript; use Ghostscript to scan-convert and print it
    #
    /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=epsonc
-sOutputFile=- - \
        && exit 0
else
    #
    #  Plain text or HP/PCL, so just print it directly; print a form
    #  at the end to eject the last page.
    #
    echo $first_line && cat && printf "\f" && exit 2
fi
exit 2

I suspect that it may be the line ' first_two_chars=`expr "$first_line"
: '\(..\)'` ' as when I try a simple filter shown below, to echo the
result of the ' first_two_chars=`expr "$first_line" : '\(..\)'` ' line
to the printer, if only prints out ' expr "$first_line" : '\(..\)' '.

#!/bin/sh
read first_line
first_two_chars=`expr "$first_line" : '\(..\)'`
echo $first_two_chars && exit 0
exit 2

Has anyone come across this problem, and how do I solve it, Thanks!

______
Lee Johnston
ljohnston@cyberworld.demon.co.uk
http://www.cyberworld.demon.co.uk




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33821BD5.BC4BBF04>