Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Apr 1998 03:02:26 -0500
From:      Zach Heilig <zach@gaffaneys.com>
To:        Lanny Baron <beef@cybertouch.org>
Cc:        freebsd-chat@FreeBSD.ORG
Subject:   Re: Printing (can't get it right)
Message-ID:  <19980428030226.36517@gaffaneys.com>
In-Reply-To: <Pine.BSF.3.96.980428003503.356B-100000@cybertouch.org>; from Lanny Baron on Tue, Apr 28, 1998 at 12:41:38AM -0400
References:  <199804272220.RAA01509@dyson.iquest.net> <Pine.BSF.3.96.980428003503.356B-100000@cybertouch.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 28, 1998 at 12:41:38AM -0400, Lanny Baron wrote:
>  To answer your question as to whether or not I have used the printer with
> another OS. Yes. With NT and 95. Using or trying to use the printer with
> FreeBSD, only prints a a few words,
>                                     then a few more words,
>                                                          then a few more.
> 
>  If you get the picture. One problem for sure is I don't know if the
> printer is ghostscript or postscript (or even what those are :-(. I don't
> blame FreeBSD (the OS or the marvelous minds attached to FreeBSD), I blame
> myself for the lack of understanding Unix. 

You want either an input filter to add CR's, or some method of telling
the printer that lines end with only NL, not CR NL.  For example, here
is my input filter for HP deskjet 890:
(if you just want to print postscript files, install the ghostscript
package, and check 'gs -?' for a cannon driver that resembles the printer
you have).

#!/bin/sh
#
# if-djet890: a filter to print plain files or postscript files
#

DPI=600

# Change this to your desired initialization string for the printer
# mode you want.  This does (for HP 800 series):
# ESC & k 2 G : CR->CR, LF->CR+LF, FF->CR+FF
# ESC & s 0 C : Turn on line wrap.
# ESC & l 0 O : Portrait orientation.
# ESC & l 2 A : US Letter sized paper.
# ESC ( s 0 P : Fixed width characters.
# ESC ( s 3 T : Courier typeface.
printf "\033&k2G\033&s0C\033&l0O\033&l2A\033(s0P\033(s3T"

read first_line
first_two_chars=`expr "$first_line" : '\(..\)'`
first_six_chars=`expr "$first_line" : '\(......\)'`

if [ "$first_two_chars" = "%!" ]; then
    (echo $first_line && cat && printf "\f") |                          \
        /usr/local/bin/gs -r$DPI -dSAFER -dNOPAUSE -q -sDEVICE=cdj850	\
        -sOutputFile=- - &&                                             \
	exit 0
elif [ "$first_six_chars" = "x T ps" ]; then
    (echo $first_line && cat && printf "\f") |                          \
        /usr/bin/grops |                                                \
        /usr/local/bin/gs -r$DPI -dSAFER -dNOPAUSE -q -sDEVICE=cdj850	\
        -sOutputFile=- - &&                                             \
        exit 0
else
    (echo $first_line && cat && printf "\f") &&				\
        exit 0
fi

exit 2
# END

/etc/printcap should look something like:

lp:HP DeskJet 890C:\
	:sh:\
	:sd=/var/spool/lpd/djet890:\
	:lp=/dev/lpt0:\
	:lf=/var/log/djet890.log:\
	:if=/usr/local/libexec/lp/if-djet890:

This will take plain text (perhaps binary files, haven't tried), postscript,
and 'zcat /usr/share/man/man5/printcap.5.gz | eqn | tbl | pic | troff -man |
 lpr' type lines.

-- 
Zach Heilig -- zach@gaffaneys.com
Real Programs don't use shared text.  Otherwise, how can they use
functions for scratch space after they are finished calling them?

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message



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