Operating System - HP-UX
1821985 Members
3436 Online
109638 Solutions
New Discussion

Formatting LPR print jobs

 
Jared Hamilton_1
Occasional Contributor

Formatting LPR print jobs

I'm running HP/UX 11.0 and have a question about LPR printing. I want to embed options, parameters, escape sequences, or whatever, so that all jobs are formatted landscape and 8 lines per inch.

I can do this with the following command:

lp -d -olandscape -olpi8

but since I always want these settings, I want to make the changes at the queue/interface level.

I have been successful at this when using JetDirect printers. I do this by modifying the /etc/lp/interface/ file on my server by appending the options I want to the $5 parameter (options="landscape"$5). This works for an HP LaserJet 4100 printing via JetDirect.

I have another 4100 that is a remote printer to my system, so the /etc/lp/interface/ file is different, and I don't know how to add thse changes. If I use the same lp command as above, it is successful in altering the output. However, I don't know how to change the interface script for the remote printer as I have done for the JetDirect printer.

I did discover that the options are passed to the interface script in the $5 parameter, but they are NOT passed in the call to rlp, so something is using that value before the interface script gets control. I also found that the remote job gets two files in /var/spool/lp/request/. One is named dA, which contains the data. The other is cA, and in this file is a line with Olandscape. So, appearently something in the spooler subsystem creates this file and includes the options _before_ control is passed to the interface script.

Now that I've rambled on about that, what is the best way to accomplish what I want? I've thought about adding the escape sequences for the commands somewhere in the interface script, but I don't know where to put it nor what the syntax is. Thanks in advance to anyone who can help.
1 REPLY 1
Bill Hassell
Honored Contributor

Re: Formatting LPR print jobs

Welcome to the world of SysV printing versus BSD. lpr is a BSD command (HP-UX doesn't have an lpr command...OK, there is a lame script that tries to emulate the front end). Anyways, BSD defines printer features in the printcap file (non-existant in HP-UX) and all formatting is complete before the job leaves the computer.

SysV actually did not define remote printing at the beginning so along came RFC 1179 to define how to send print jobs and just to be different, SysV defined print job numbers as 4-digits while BSD defines only 3-digit print jobs. Hence the lpadmin (and SAM) option for BSD.

But that's the easy part. The hard part is a primary functional difference between BSD and SysV printing: BSD completely formats the job before it leaves, while SysV requires that the remote side understand the -o control file options. In other words, the remote machine must do all the formatting, not the local one.

Oops, that's a show stopper. If that remote printer is on a toy (I mean PC) computer, there is nothing in the lpd code to process any -o options from HP-UX. Now if the remote computer is HP-UX, there is no problem since the remote HP-UX system will handle the -o options just fine.

So what to do? Well there is an easy choice, a medium choice and a hard one. The hard one is to create an lp wrapper script that is based on an existing model script. With a fair amount of scripting, it can accomplish the formatting and send the job correctly formatted to any remote print server.

The medium choice is to get another HP-UX machine to replace the remote server. Your HP sales rep can help you with that choice.

Or the easy way (you already know this one): pull out the other 4100 and stick a JetDirect card in it. Now everything will work fine.


Bill Hassell, sysadmin