Subject: Re: Remote printing and CR
To: Hubert Feyrer <hubert.feyrer@rz.uni-regensburg.de>
From: Roger Brooks <R.S.Brooks@liverpool.ac.uk>
List: current-users
Date: 07/08/1999 16:50:49
On Thu, 8 Jul 1999, Hubert Feyrer wrote:

>In article <m111zfM-0000bFC@druid.net> you wrote:
>> I am having problems going to a HP Laserjet 5Si MX network printer.  It
>> acts like an ordinary lpd type printer except it won't add a CR to newline
>> so I am trying to add a filter to add them in.  Problem is that lpd won't
>> run a filter for remote printers.  Since I can't muck around on the HP,
>> can someone suggest the magic I need to add the CR in?
>
>Here's what I use on our networked LJ4s:
>
>lp|hpgv|HP Laserjet 4m+ Grafiklabor:\
>        :lp=9100@rfhps2005:sd=/var/spool/output/hpgv:\
>        :lf=/var/log/lpd-errs:\
>        :sh:if=/usr/local/magicfilter-1.2/bin/ljet4m-filter:
>
>Note the use of the "lp" field.

There are two way to talk to HP JetDirect cards/pods using TCP/IP:

    1.  You can open a TCP connection to port 9100 (as in the example
        above).  Note that the queue is configured as a LOCAL queue
        (i.e. there is an lp=port@host).  This allows you to run any
        filters you like on the Unix host, so you can do things like:

            ASCII -> PS conversion (if you have a real PS printer).
            Run Ghostscript in the print filter.
            Do PS page accounting.
            Run magicfilter.
            Otherwise bugger about with the data stream, for example
            to override page size and/or paper tray selections.

    2.  You can configure a REMOTE queue with a printcap entry which
        includes the fields

            :rm=printer-hostname:rp=queue-name:

        This results in lpd on your Unix system using LPD protocol to send
        the job to port 512 in the JetDirect.  Because the JetDirect now
        behaves as a remote print spooler, the standard BSD lpd
        won't run any filters (even if you specify them in the printcap).
        The JetDirect provides two queues: text (which routes the data
        through an internal NL -> CR NL filter) and raw (which doesn't).
        Apart from this, you can't do any other manipulations to the
        data stream once it's spooled.  There are some other subtle
        differences, for example the job banner page is generated within
	the JetDirect card, not by lpd.

The PLP print spooler (we use a version of this with significant local
modifications, including a print quota system) allows the printcap entry
to specify prefilters, which are run by lpr when the user queues the job.
PLP prefilters can also change the data format of the file, for example
you can set a queue up so that if a user types

    troff .... | lpr -n 

(to print DITROFF output), then lpr runs a DITROFF -> PS filter, and
generates a print job control file with an 'f' record (instead of an
'n' record).  The downside of this is that DITROFF is usually rather more
compact than the resulting PS, so you need more spool area.

But PLP prefilters only work if you use the PLP version of lpr (and
you have to configure the prefilters in the printcap on every machine).
If you queue the job on a machine which has the vanilla BSD lpr, there
is no way the prefilter can get run.


Roger

------------------------------------------------------------------------------
Roger Brooks (Systems Programmer),          |  Email: R.S.Brooks@liv.ac.uk
Computing Services Dept,                    |  Tel:   +44 151 794 4441
The University of Liverpool,                |  Fax:   +44 151 794 4442
PO Box 147, Liverpool L69 3BX, UK           | 
------------------------------------------------------------------------------