Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Sep 2006 17:12:10 -0700
From:      Gary Kline <kline@sage.thought.org>
To:        FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG>
Subject:   triouble with my Deskjet 500
Message-ID:  <20061001001210.GA82422@thought.org>

Next in thread | Raw E-Mail | Index | Archive | Help

	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
#
# Simply copies stdin to stdout.  Ignores all filter arguments.
# Tells printer to treat LF as CR+LF. Writes a form feed character
# after printing job.

###printf "\033&k2G" && cat && printf "\f" && exit 0

#
#  ifhp - Print Ghostscript-simulated PostScript on a DeskJet 500
#  Installed in /usr/local/libexec/ifhp

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

#
#  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.

	thanks much,

	gary

	PS:  I tried printing a graphic file remote; my printer spat out 
	     hex.  Now I tried small graphic with xv and Print.  Same
	     thing.... .




-- 
   Gary Kline     kline@thought.org   www.thought.org     Public service Unix




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20061001001210.GA82422>