Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jan 1997 14:15:46 -0600 (CST)
From:      "Paul T. Root" <proot@horton.iaces.com>
To:        ping@stepnet.com (Ping Mai)
Cc:        freebsd-questions@freebsd.org
Subject:   Re: postscript printing via non-postscript printer
Message-ID:  <199701282015.OAA06128@horton.iaces.com>
In-Reply-To: <199701281941.LAA01603@tibet.stepnet.com> from Ping Mai at "Jan 28, 97 11:41:11 am"

next in thread | previous in thread | raw e-mail | index | archive | help
In a previous message, Ping Mai said:
> is it possible to setup a non-postscript printer to print postscript
> using ghostscript?  the printer i have in mind is a canon bjc-4550, or
> a hp lj 5l.  if the answer is yes can somebody give me some pointers
> to printcap, filter, gs setup.
> 

Sure can, I have a bjc-4100. It works great! Your HP will be similar,
just put a different device in the gs line. BTW, this is all in the
FreeBSD handbook, under printing (Chapter 7 I think).

printcap:

#	@(#)printcap	5.3 (Berkeley) 6/30/90

lp|local line printer:\
	:lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:\
	:if=/usr/local/libexec/canonif:sh:


canonif:


#!/bin/sh
#
#  ifhp - Print Ghostscript-simulated PostScript on a Cannon BJC-4100
#  Installed in /usr/local/libexec/cannonif

#
#  Treat LF as CR+LF:
#
printf "\033&k" || exit 2

#
#  Read first two characters of the file
#
read first_line
first_two_chars=`expr "$first_line" : '\(..\)'`

if [ "$first_two_chars" = "%!" ]; then
    #
    #  It's PostScript; use Ghostscript to scan-convert and print it
    #
    /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=bjc600 -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



-- 
    In a Wonderland they lie,           Ever drifting down the stream--
    Dreaming as the days go by,         Lingering in the gold gleam--
    Dreaming as the summers die:        Life, what is it but a dream?

                                                --Lewis Carol



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