Re: triouble with my Deskjet 500
- From: Ian Smith <smithi@xxxxxxxxxxxxx>
- Date: Mon, 2 Oct 2006 02:49:56 +1000 (EST)
Re: freebsd-questions Digest, Vol 152, Issue 13
On Sun, 1 Oct 2006 freebsd-questions-request@xxxxxxxxxxx wrote:
Message: 30
Date: Sat, 30 Sep 2006 17:12:10 -0700
From: Gary Kline <kline@xxxxxxxxxxxxxxxx>
Subject: triouble with my Deskjet 500
Hi Gary,
The trouble is that it only prints in ASCII Aand fails to fails[..]
to print xv images or anything else PostScript. I'm playing
around withthe following in /usr//local/libexec:
#!/bin/sh
#
# hpif - Simple text input filter for lpd for HP-PCL based printers
# Installed in /usr/local/libexec/hpif
# Read first two characters of the file
#
IFS="" read -r first_line
first_two_chars=`expr "$first_line" : '\(..\)'`
if [ "$first_two_chars" = "%!" ]; then
#
# It is PostScript; use Ghostscript to scan-convert and print it.
#
# Note that PostScript files are actually interpreted programs,
# and those programs are allowed to write to stdout, which will
# mess up the printed output. So, we redirect stdout to stderr
# and then make descriptor 3 go to stdout, and have Ghostscript
# write its output there. Exercise for the clever reader:
# capture the stderr output from Ghostscript and mail it back to
# the user originating the print job.
#
exec 3>&1 1>&2
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 \
-sOutputFile=/dev/fd/3 - && exit 0
else
#
# Plain text or HP/PCL, so just print it directly; print a form feed
# at the end to eject the last page.
#
echo "$first_line" && cat && printf "\033&l0H" &&
exit 0
fi
It's pretty obviouslythat I can toss the first several lines that
came from the originl hpif file; this was before I cared about
graphics. I lost the ghostscript part when my system had its
fatal trap. Anybody out there who has an ancient hp djet500?
or can help otherwise. I'm out of ideas.
I ran into exactly this after upgrading 4.5-R to 5.4-R (now 5.5-S); that
fancy stderr/stdout dance doesn't seem to work &/| be needed anymore. I
got sick of Mozilla crashing trying to print and dug up this fix, forget
where/how. Way over commented, but times like this it comes in handy :)
#!/bin/sh
#% /usr/local/libexec/if-lq850 smithi 6/4/3
#% v2 29/6/6, maybe the 3>&1 stuff is what doesn't work in 5.4-R?
#% as advised by FreeBSD handbook, from:
# ifhp - Print Ghostscript-simulated PostScript on a DeskJet 500
# as installed in /usr/local/libexec/hpif
#% modified for printer canon bj10sx (configured as an epson lq850)
# Treat LF as CR+LF:
# (HP specific - and the bj10sx is switch-set for this)
# printf "\033&k2G" || exit 2
# Read first two characters of the file
#% was 'read first_line' - presumably this ignores \ or spaces
IFS="" read -r first_line
first_two_chars=`expr "$first_line" : '\(..\)'`
if [ "$first_two_chars" = "%!" ]; then
#% dunno where I found this? Worked on 4.5, but not on 5.4?
if 0; then
# It is PostScript; use Ghostscript to scan-convert and print it.
#
# Note that PostScript files are actually interpreted programs,
# and those programs are allowed to write to stdout, which will
# mess up the printed output. So, we redirect stdout to stderr
# and then make descriptor 3 go to stdout, and have Ghostscript
# write its output there. Exercise for the clever reader:
# capture the stderr output from Ghostscript and mail it back to
# the user originating the print job.
exec 3>&1 1>&2
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=lq850 \
-sOutputFile=/dev/fd/3 - && exit 0
fi
#% instead use the default as per current handbook
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=lq850 \
-sOutputFile=- - && exit 0
else
# Plain text [or HP/PCL], so just print it directly; print a form feed
# at the end to eject the last page.
#% use w/out closing ff, was:
#% echo $first_line && cat && printf "\033&l0H" && exit 0
#% looks HP-specific .. how about just (12d = $0c =) printf "\014" ?
echo $first_line && cat && exit 0
fi
exit 2
# Finally, you need to notify LPD of the filter via the if capability:
# :if=/usr/local/libexec/hpif: in /etc/printcap
#% :if=/usr/local/libexec/if-lq850
# That is it. You can type lpr plain.text and lpr whatever.ps
# and both should print successfully.
Cheers, Ian
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: triouble with my Deskjet 500
- From: Gary Kline
- Re: triouble with my Deskjet 500
- Prev by Date: Re: RAM problems
- Next by Date: pcm0 + rl0 in the same irq causes panic
- Previous by thread: triouble with my Deskjet 500
- Next by thread: Re: triouble with my Deskjet 500
- Index(es):
Relevant Pages
|