*BSD News Article 70670


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.sdsmt.edu!news.mid.net!mr.net!chi-news.cic.net!newsxfer2.itd.umich.edu!tank.news.pipex.net!pipex!dispatch.news.demon.net!demon!jraynard.demon.co.uk!not-for-mail
From: james@jraynard.demon.co.uk (James Raynard)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Filter for HPDeskJet500C wanted
Date: 11 Jun 1996 08:27:23 -0000
Organization: A FreeBSD Box
Lines: 86
Message-ID: <4pjalb$q4@jraynard.demon.co.uk>
References: <9ckBPD1w165w@tusia.kiel.org>
NNTP-Posting-Host: localhost.demon.co.uk
X-NNTP-Posting-Host: jraynard.demon.co.uk

In article <9ckBPD1w165w@tusia.kiel.org>,
Maciej Wiatr <macko@tusia.kiel.org> wrote:

>I have fought with my printer for some days and reached nothing.
>After reading the printing.sgml file I installed the filter file,
>which is given there as one for HPDeskJet500 series :
[snip]
>printf "\033&ero;k2G" || exit 2
>
>Every time I want to print I get the massage in the error file :
>
>ero : not found

'&ero;' is the SGML representation of an ampersand, '&', so the line
should read

printf "\033&k2G" || exit 2

and similarly in the other cases.

Here's the filter file I use with a DJ520, which is more or less taken
straight from the handbook. I had a couple of problems which baffled
me for a while, though:-

1. Be careful if you cut and paste these scripts from an HTML
   browser. Somewhere along the line, a load of junk gets appended
   that gives a 'cannot execv' error from lpd. Solution: remove
   any trailing spaces after the '#!/bin/sh' on the first line.

2. A bug in ghostscript that results in garbage being printed, as the
   driver puts it in compression mode 3 when my printer can only manage
   mode 2. Solution: apply the patch at the end of this article. (I
   reported this bug in version 2.63, but it's still in 3.51)

#!/bin/sh
#
#  ifhp - Print Ghostscript-simulated PostScript on a DesJet 500
#  Installed in /usr/local/libexec/hpif                                 

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

#
#  Read first two characters of the file                              
#
read first_line                                                        
first_two_chars=`expr "$first_line" : '\(..\)'`

if [ "$first_two_chars" = "%!" ]; then                             
    #                                                                   
    #  It is PostScript; use Ghostscript to scan-convert and print it  
    #
    /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 -sOutputFile=- - \
        && exit 0

else                                                                    
    #
    #  Plain 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 2       
fi

exit 2

Patch for ghostscript3.51
=========================

--- gdevdjet.c.orig     Tue Jun 11 08:19:51 1996
+++ gdevdjet.c  Tue Jun 11 08:20:36 1996
@@ -323,7 +323,7 @@
 /* The DeskJet500 can compress (modes 2&3) */
 private int
 djet500_print_page(gx_device_printer *pdev, FILE *prn_stream)
-{      return hpjet_print_page(pdev, prn_stream, DJ500, 300, mode_3,
+{      return hpjet_print_page(pdev, prn_stream, DJ500, 300, mode_2,
                "\033&k1W");
 }
 /* The LaserJet series II can't compress */
-- 
James Raynard, Edinburgh, Scotland
james@jraynard.demon.co.uk
jraynard@FreeBSD.ORG