Subject: Re: Getting output from Printer
To: None <rbsd@Kyra.FutureGroove.de>
From: Peter Berg <root@line1.slipneu.tu-freiberg.de>
List: port-arm32
Date: 07/26/1998 20:31:33
> Steve,
>=20
> Yes found I hadn't enable the lpd daemon in rc.
> =20
> However still cannot get any  output other than two blank pages every
> time I use the lpr -PHP5L /public/textfile
> [snip]=20
> Any ideas why I cannot get anything but blank pages.

No idea what exactly is going wrong at your side, but you may try the
following:

[entry in /etc/printcap]
lp:\
        :lp=3D/dev/lpa0:\
	:if=3D/var/spool/lpd/lp-filter:\
        :sd=3D/usr/spool/lpd:\
        :lf=3D/var/spool/lpd-errs:\
	:la:mx#0:\
	:sh:sf:

the following lines are the file 'lp-filter', which is used in the if field.
This filter lets you print printer images, ascii files (if your printer
supports this), PS, PDF, PS.gz and PDF.gz directly on the standard printer
without prior conversion. You only must change the entry for DEV in the
script and you must have ghostscript for this to work.=20

Ciao, Peter.



#!/bin/sh

GS=3D/usr/pkg/bin/gs
DEV=3Ddjet500
RES=3D300

#### nothing to modify below this line ####

PTMP=3D/tmp/printout.djet.$$
ITMP=3D/tmp/printfile.$$

cat > $ITMP

# read the first four bytes from the file, mostly these bytes indicate the
# fileformat, and store them into this variable

MAGIC=3D`dd bs=3D4 count=3D1 if=3D/tmp/printfile.$$ 2> /dev/null`

#
# postscript files
#
if [ $MAGIC =3D "%!PS" ]
then
	$GS -r$RES -q -dNOPAUSE -sDEVICE=3D$DEV -sOutputFile=3D- $ITMP

	rm $ITMP
	exit
fi

#
# PDF files
#
if [ $MAGIC =3D "%PDF" ]
then
	$GS -r$RES -q -dNOPAUSE -sDEVICE=3D$DEV -sOutputFile=3D- $ITMP

	rm $ITMP
	exit
fi

#
# gzip komprimierte PS oder PDF files
#
if [ $MAGIC =3D "=1F=8B=08=08" ]
then
	gzip -d < $ITMP | $GS -r$RES -q -dNOPAUSE -sDEVICE=3D$DEV -sOutputFile=3D-=
 -

	rm $ITMP
	exit
fi

#
# 3 buchstaben magic, da bzip2 anscheinend kuerzere magics verwendet
#
MAGIC=3D`dd bs=3D3 count=3D1 if=3D/tmp/printfile.$$ 2> /dev/null`

#
# bzip2 komprimierte PS oder PDF files
#
if [ $MAGIC =3D "BZh" ]
then
	bzip2 -d < $ITMP | $GS -r$RES -q -dNOPAUSE -sDEVICE=3D$DEV -sOutputFile=3D=
- -

	rm $ITMP
	exit
fi

#
# alles andere, vermutlich deskjet printer-image files
#
cat $ITMP
rm $ITMP