Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 1997 11:41:46 +0200
From:      Robin Huiser <robinh@htsa.hva.nl>
To:        rknebel@mail.microserve.net
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: printer
Message-ID:  <342A31D8.5ECDCE4F@htsa.hva.nl>
References:  <199709242157.HAA25783@smmcroute.smmc.qld.edu.au> <19970924195634.48713@my.domain>

next in thread | previous in thread | raw e-mail | index | archive | help
rknebel@mail.microserve.net wrote:

> Hi,
> I have freebsd 2.2.2 and am trying to get my printer to work.
> I have a HP 660c.
> Whenenver I try to print something the printer prints out three blank
> pages and then stops.
> Can anyone get me started on a solution?
> Thanks Alot
>
> --
> Rick Knebel
> rknebel@mail.microserve.net

 Hello Rick!

It seems that we have the same printer!
I have written a few scripts allowing you to print postscript directly
to your printer!
It also recognises if you are sending plain text, binary printer-format
or postscript!

First create in /etc/printcap the following line:

deskjet|lp|HP Deskjet 694-C bubblejet printer:\
     :sh:sd=/var/spool/lpd/deskjet:lp=/dev/lpt0:mx#0:\
     :if=/usr/local/libexec/if-deskjet:

* It tells FreeBSD that you have a printer connected to /dev/lpt0
(LPT1).
* Your spool-directory is  /var/spool/lpd/deskjet  (CREATE IT!!!)
* Because postscript jobs are sometimes of a very *LARGE*,size  (For
example if you print a picture with xv),  I have set the mx-field to 0.
(No size limits when printing a job).
* The filter is in  /usr/local/libexec/if-deskjet (CREATE IT!!!)

Filter: if-deskjet

-- BEGIN HERE --

#!/bin/sh
#
# if-hp - Postscript level 3 and text input filter for lpd
# Installed in /usr/local/libexec/if-hp
#
# Textmode: simply copies stdin to stdout. Ignores all filter arguments
# Postscript: run gs to convert the text you want to print
# Add a formfeed after each job

#
# Some handy functions
#
fatal() {
   echo "$@" 1>\&2
   exit 2
}

#
# Set LF to LF+CR
#
printf "\033\&k2G" || fatal "Cannot initialize printer"

#
# 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 -sPAPERSIZE=a4 -q -sDEVICE=cdj550
-sOutpu
tFile=- - && exit 0
else
   #
   # Plan 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 0 || exit 2
fi

exit 2

-- CUT HERE --

Well, if you have any questions,
you know where to find me!

Greets,

Robin Huiser
                                      ,,,
                                     (o o)
       ()========================oOO==(_)==OOo==========================()
                Robin Huiser
                HVA Faculteit Electrotechniek & Informatica
                E-mail: robinh@htsa.hva.nl

Important Unix command:
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' | dc






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