[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: HPLJ4, PCL, specifically tray selection



On Wed, Aug 29, 2001 at 04:32:30PM -0700, Karsten M. Self wrote:
> Another PITA:
> 
> I've got a Hewlett Packard LaserJet 4 Printer, it's got a primary and
> manual feed tray.  Question is:  how do I indicate a job's supposed to
> go to the manual-feed tray?
> 
> I suspect it's a PCL issue.

if it's a non-postscript printer, yes.

> I've found a page with a list of codes that looks promising:
> 
>     http://www.hp.com/cposupport/printers/support_doc/bpl02705.html

(thanks for the pointer, BTW.  Good to know there exists such a page.
At the moment I don't really need the info -- but who knows when the
time comes ;)

>
> ...but hell if I know how to apply them.
> 
> I'm using lpr.  I remember some stuff from way back when I ran on HPUX
> that we'd throw a slew of options at the printer with jobs for various
> output options (usually portrait/landscape orientation).  I'm hoping
> that I can do something here either with a '-o' option or with a
> printcap configuration.

If I were in the situation, I'd start my first experiments by cat-ing
the stuff directly to the printer device to avoid having to deal with
the lpr system at this stage of experimentation.

I'd write myself a little script to ease transferring the information
from the above webpage to my printer. It could look something like:

#!/usr/bin/perl

my $manual_feed = pack "H*", join "", qw(1B 26 6C 32 48);

   # $manual_feed now is a 5-byte binary string representing the
   # PCL escape/control sequence for "manual feed"

print $manual_feed, <>;

This does nothing more than assembling the escape sequence specified in
hex notation (as found in the last column of the table on the webpage)
into the (binary) string that needs to be sent to the printer. This
string is then simply prepended to the data to be printed. The script
can be used as a pipe or be called with argument(s) representing the
files to be sent to the printer. It's meant as an example only -- with
a hardcoded PCL sequence for selecting the manual-feed paper option.
(The idea is just to make it easy to cut & paste the sequences form the
webpage without too much editing...)

Once you have the PCL sequences causing the desired effects in the
printer, you could proceed to the next step, which would be the
question how to integrate that into the lpr system.

Basically, I'd try to use printcap's facility to specify filters. In
this particular case it wouldn't matter much whether you use the 'if'
or the 'of' filter (though, if you already have a filter configured,
you'd somehow have to chain/merge their effects, of course, e.g. by
making one filter a wrapper for the other...). Also, IIRC, the 'of'
filter will only get called when there's no 'if' filter -- see the
manpage for details.

The filter would be a script resembling the above example.
Theoretically, the filter could be passed some options that would
control its detailed behaviour (manual-feed, tray-1, tray-2, etc.), yet
there remains the problem of how to get the option to the script.  I'm
not aware of a general option passing facility in the lpr system -- the
'-o' is specific to the lp system, AFAIK.  Yet, I may simply not have
been reading the manpage carefully enough ;)

So, I assume it would get quite cumbersome to pass some custom options
to the filter.  The easiest workaround would probably be to setup
several, differently named printers in printcap (which would all be
printing to the same physical device), specifying a different filter
for each one, which would take care of prepending the required PCL
control sequences.  Selecting a paper tray would then be matter of
specifying the dedicated printer (alias) via the usual -P option. 
Someone else might have a better idea...

Also, more generally, the whole approach of simply *prepending* some
PCL escape sequences would not be able to deal with data already
containing conflicting PCL code, as might be generated by some
applications. For example, if an application insists on generating
PCL code to select tray-1, this would simply override any attempts to
select manual-feed, etc., as the 'tray-1' code appears later in the
stream sent to the printer...

Anyhow, these are just a few thoughts -- I haven't actually tried
anything of this :)

Cheers,

-- 
Erdmut Pfeifer
science+computing ag

-- Bugs come in through open windows. Keep Windows shut! --



Reply to: