From: polly@leland.Stanford.EDU (polly siegel)
Subject: Summary: How to enable Duplex printing from printcap?
Organization: DSG, Stanford University, CA 94305, USA
Date: Wed, 19 Aug 92 23:04:14 GMT

I posted a query to the net on how to access the duplex feature on my
HP LaserJet IIID printer (with PostScript) from the BSD lpr interface.
I've received a lot of responses and have arrived at a couple of solutions to
the problem, so I thought I'd summarize here.  Thanks to everyone who
responded!

No solution seemed to solve the complete problem, but it looks like we have
a hybrid solution that should work.

First, to summarize the problem:

We have an HP LaserJet IIID printer which has duplex (two-sided) printing
and PostScript, along with some other options.  The printer is connected
to a DEC 5000/240 running Ultrix 4.2.  Other machines access the printer
through the network; most of the machines are DEC machines, but not all.
I wanted to be able to access the fancy features of the printer through the
lpr rather than having to manually set them on the printer.

Possible solutions:

1. Modify lpr.  If you read the lpr man page, you'll notice that for
normal printers, no general capabilities are provided to access special
features of a particular printer (as in the system V lp command).  Since I
didn't have the source to lpr, and since that would change with any operating
system upgrade, I decided not to modify lpr to add my own options (which would
then get sent to my print filters).

2. Configure the printer as a DEC Print Server.  If you read the lpr man page
further, you'll find that lpr supports a bunch of printer-specific options
which includes the features I wanted access to.  However, you must enable the
printer as a Print Server to gain access to them.  The DEC documentation
refers to specific DEC printers when talking about print servers, and despite
trying various options in printcap, I could never get this to work for
my printer.  So I gave up on this option.  (Maybe someone has some more
information on this?)

3. Use an existing option to lpr that isn't being used.  Here, we can snarf
an unused option (say, -i or something) and modify the input filter to snag
it and output the appropriate PostScript code.  This approach is tempting but
is potentially perilous since you can't be sure that no one will want to use
that option.  This solution also requires an understanding of the filters that
the printer uses (as set in /etc/printcap) so that you can insert the
postscript code at the appropriate place.

What I finally settled on was a script and a filter.  The script, supplied by
Andy Sun (andy@ie.utoronto.ca) (and modified slightly by me), is for printing
PostScript files.  It simply prepends the appropriate PostScript codes for the
options you want.  The flags to lpr are the same as the flags documented for
Print Servers -- so -K2 will get you duplex printing.  To print a postscript
file you then simply say "lprscript -K2 myfile" and it will print it with
duplex printing to $PRINTER.  If you're interested in this you can send me
mail...

Gary Beckmann (gary@zeus.dfci.harvard.edu) sent me a pointer to the program
"psf", written by Tony Field (tony@ajfcal.cuc.ab.ca).  This can be ftp'd
from pub/psf/psf3.5.tar.Z at fsa.cpsc.ucalgary.ca.  This program (or set
of programs) provided filters for normal text files and other sorts of files
to allow you to access both special capabilities of the printer and to
do other special printing things, such as 2-up and 4-up printing.  It's
basically a postscript filter that runs in front of lpr which inserts all
the appropriate options in postscript.  So, to print a text file 4-up and
in duplex mode (for major space savings), you'd say "psf -4 -D myfile | lpr".

psf is really easy to install and supports just about any printer you'd
want to support.  Be aware that the printer definition file for the
HP LaserJet IIID with PostScript Plus has some errors, so if you're interested
I can send you my modified PostScript definition file.

So I can use lprscript for PostScript files, and psf for non-PostScript files
to access the full capabilities of the printer.

I would still like to be able to configure this printer as a Print Server, and
I might work on this some more.  If someone out there knows
that it either can or can't be done, I'd appreciate hearing about it.

We had also had some trouble getting the right printcap definition, so if
anyone is interested I can send that to them too.  (Should this stuff possibly
go in a FAQ just in case anyone else is interested in it?)

Thanks again for all the responses!

- polly

--------
Polly Siegel
Stanford University
(polly@grover.stanford.edu)


Newsgroups: comp.unix.ultrix