Some comments regarding Lasterjet printers.

> >I'm using hpnpf to print to a TCP/IP printer.  I get the CR/LF just
> >fine using the -N option, but only if there's a CR/LF in the file being
> >printed.  I have lines that span past 80 columns, and they just print
> >off the page.  How do I get hpnpf to wrap lines greater than 80 columns?

This is the printers job, not the operating system or application.

Enable the "end-of-line wrap" feature on your unspecified tcp/ip printer. Assuming said printer is made by HP, and supports PCL3 or higher, and assuming that you're using the SCO HPNP print spooler scripts, you should be able to just add the necessary commands to initialization string. EOL Wrap Hex Enabled &s0C 1B 26 73 30 43 Disabled &s1C 1B 26 73 31 43

I don't think you'll be happy with the results since HP counts lines per page based upon input (sent to printer) lines, not output (printed). This will cause you page count to go insane. I have this problem when printing program listings that run off the page. If it's one continuous program, the wrap is not much of a problem. However, if my wiz bang integrated environment insists of pre-formatting and paginating the listing, it looks awful.
Well, sometimes the OS can do a better job of it- "fold -s" in the interface script will do it at word boundaries and I bet the printer won't..

Once the print job hits the printer you can get it to reset everything done by the interface by added something like:

            |that's an ell after the &
at which point it won't matter what the interface script is doing. This gives you a half inch margin top and bottom, with 80 print lines at 8 lpi.

FYI, a LaserJet NEVER counts lines as such. It does use the "lines to print" per page to locate the bottom margin which is a function of, quite logically, the top margin size, lines to print, AND the line spacing. More than 66 lines are not going to fit on a letter sized sheet if you are at 6 lpi. When requesting legal size from you, the printer is telling you that the text will NOT fit on the sheet.

If you want to disable the auto formfeed, then try <esc>&l0L, after which your application will have to supply timely formfeeds.

LaserJet Stair Stepping

Tack onto the end of the setup string I gave you


That should take care of the "staircase" you are seeing. This code tells the printer to insert a CR when receiving a LF.

The font code I gave you, specifically selects the "line printer" font. With a modern LaserJet, the concept of a "condensed" font becomes somewhat fuzzy, as in your HP4 there are three different typfaces that can be printed at 16.6 cpi. If you only give it the <esc>(s16.6H, I think you would probably end up with courier.

The printer has a whole set of rules that it follows if you give an incomplete font select instruction. While HP has opted for some very reasonable defaults, it can bite you from time to time.

RE: < This code tells the printer to ignore the bottom margin. The bottom margin is simply an address somewhere down the page from the top margin where the printer will do a page eject if a linefeed or half linefeed move the cursor pass that point on the page. The printer WILL still eject the page if you eventually go off the boottom of the sheet. It soulnds to me as though your ling spacing is still too fat.

The easy Way

I had a few minutes the morning and set up a printer using the HPLaserJet interface.

The following command line delivers a 160 line text file complete on 2 pages of 80 lines each.

lp -d printername -o lpi8 -o l88 -o tl80 -o nobanner filename


I see now where the formfeeds are coming from.

The HPLaserJet script pipes "cooked" output through /usr/lib/lprpp, and that's where it appears the FF's are introduced. I can't find any documentation for that program.

If the cooked output is piped through "cat" then the FF's disappear.

        0<${file} eval ${FILTER}  | cat 2>&1;;

The only thing I needed to change in my reports is the "lp -s -dlaser" to "lp -s -dhpfox". I also had to comment out the <ESC>'E' since it appears the model file is already sending it, when sent twice the output is unpredictible.

Comments and suggestions always welcome - tom@tkrh.demon.co.uk