Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2003 00:38:19 +0930
From:      Malcolm Kay <Malcolm.Kay@internode.on.net>
To:        Gary Schenk <gwschenk@socal.rr.com>, Mike Meyer <mwm@mired.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Newbie lpd printing
Message-ID:  <200304250038.19869.Malcolm.Kay@internode.on.net>
In-Reply-To: <200304231843.11719.gwschenk@socal.rr.com>
References:  <200304102145.25225.gwschenk@socal.rr.com> <200304231725.59212.Malcolm.Kay@internode.on.net> <200304231843.11719.gwschenk@socal.rr.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 24 Apr 2003 11:13, Gary Schenk wrote:
> On Wednesday 23 April 2003 12:55 am, Malcolm Kay wrote:
> > Until now I thought you had solved your printer problem. Some more
> > information would probably help:
> >  Which Epson printer do you have -- is it an inkjet? -- which particu=
lar
> > model.
>
> That Epson was an old junker that was just for experimenting. The quali=
ty
> was very poor, and I've replaced it with a HP 6122.
>
> >  Do you have ghostscript installed? Aladdin or Gnu?
>
> Gnu.
>
> > With this information we can possibly fix the filter script for you.
> >
> > A relatively simple filter switching between plain text and postscrip=
t
> > should be fairly simple to implement if your printer is supported by
> > ghostscript.
>
> That was the impression I got from my research. The script befuddles me=
, as
> I got it from two very good sources. I realize that I need to learn she=
ll
> programming, and I am working on that, but I have a real need to print
> now.
>

You might find it worthwhile to look at:
http://www.linuxprinting.org/show_printer.cgi?recnum=3DHP-DeskJet_6122
The site is written with linux in mind but most applies just as well to=20
FreeBSD.

It would seem that the simplest way to get something out from a postscrip=
t=20
source is to use (more or less) the script you found in the handbook with=
=20
some change in the options for 'gs'. The simplest seems to be to set=20
-sDEVICE=3Dcdj970
The appears to be an error in the version in the hand book ->
    #!/bin/sh
    #
    #  ifhp - Print Ghostscript-simulated PostScript on a DESKJET 6122
    #  Installed in /usr/local/libexec/hpif
  =20
    #
    #  Treat LF as CR+LF:
    # (I don't know whether this works or needed for the 6122)
    printf "\033&k2G" || exit 2
  =20
    #
    #  Read first two characters of the file
    #
    read first_line
    first_two_chars=3D`expr "$first_line" : '\(..\)'`
  =20
    if [ "$first_two_chars" =3D "%!" ]; then
        #
        #  It is PostScript; use Ghostscript to scan-convert and print it=
=2E
        #
        #  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=3Dcdj970 \
            -sOutputFile=3D/dev/fd/3 - && exit 0
  =20
        # The next line seems to have been retained in error
        # /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=3Dcdj970 \
        #   -sOutputFile=3D- - && 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.
        # (the FF code may not be correct for this printer)
        # (The code "\014" is more nearly universal)
        echo $first_line && cat && printf "\033&l0H" &&
    exit 0
    fi
    exit 2

I don't know what the default resolution will be -- if it is high the=20
ghostscript conversion and data transfer could be quite slow and you=20
may like to try a resolution reduction with the option -r600 or -r300
although just what effect this will have depends somewhat on the device
and I have no experience with the 6122.

For better results you should use -sDEVICE=3Dijs but then you'll need to =
specify=20
a number of other options. Take a look at ->
file://localhost/usr/local/share/ghostscript/6.52/hpijs/hpijs_readme.html
using your favourite browser. I think you'll find hpijs is already instal=
led=20
in /usr/local/bin.

You might note that outputs passed directly from stdout to the print queu=
e
are rejected by default if they get to be too big -- which is not unlikel=
y if
pictures are included. This can be avoided by adding ':mx#0' to the print=
cap
entry for the printer.

Malcolm
=20



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304250038.19869.Malcolm.Kay>