Newbie lpd printing
gwschenk at socal.rr.com
Thu Apr 24 22:23:46 PDT 2003
On Thursday 24 April 2003 08:08 am, Malcolm Kay wrote:
> 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
> > > particular model.
> > That Epson was an old junker that was just for experimenting. The
> > quality 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
> > > postscript 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 shell programming, and I am working on that, but I have a real
> > need to print now.
> You might find it worthwhile to look at:
> The site is written with linux in mind but most applies just as well to
> It would seem that the simplest way to get something out from a
> postscript source is to use (more or less) the script you found in the
> handbook with some change in the options for 'gs'. The simplest seems to
> be to set -sDEVICE=cdj970
> The appears to be an error in the version in the hand book ->
> # ifhp - Print Ghostscript-simulated PostScript on a DESKJET 6122
> # Installed in /usr/local/libexec/hpif
> # Treat LF as CR+LF:
> # (I don't know whether this works or needed for the 6122)
> 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. #
> # 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=cdj970 \
> -sOutputFile=/dev/fd/3 - && exit 0
> # The next line seems to have been retained in error
> # /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=cdj970 \
> # -sOutputFile=- - && exit 0
> # 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
> exit 2
> I don't know what the default resolution will be -- if it is high the
> ghostscript conversion and data transfer could be quite slow and you
> 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=ijs but then you'll need to
> specify a number of other options. Take a look at ->
>l using your favourite browser. I think you'll find hpijs is already
> installed in /usr/local/bin.
> You might note that outputs passed directly from stdout to the print
> queue are rejected by default if they get to be too big -- which is not
> unlikely if pictures are included. This can be avoided by adding ':mx#0'
> to the printcap entry for the printer.
Thanks for sending this along. I'll give it a try as soon as possible.
Several people have been quite helpful. I never got this kind of support
from that company in Redmond, that's for sure. :-)
I'll let the list know how it works out.
More information about the freebsd-questions