System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

linux compressed print command

 
Jason Moorhead_2
Frequent Advisor

linux compressed print command

Hi all, doing a hp-ux to linux migration and it's going great. One last item I can't seem to solve is compressed printing.

In hp-ux, the job runs "lp -d -oc " and it prints perfect.

I haven't been able to duplicate the -oc functionality in Red Hat 5.5.

Any ideas what a comparable -oc option is via the lp command in linux?

Thanks!
Jason
4 REPLIES
Matti_Kurkela
Honored Contributor

Re: linux compressed print command

All the -o options of the HP-UX lp command are specific to the printer model script. Therefore it would have been useful to know the model of the printer you're using.

At least in "laserjet4" model script, the script command that sends the compressed printing PCL command to the printer is:

echo "\033(s16.66H\c"

Looking at the PCL reference manuals, this selects a 16.66 characters per inch pitch instead of the default 10 cpi.

In RHEL 5.5, you might try this instead:

lp -d -o cpi=16.66

MK
MK
Jason Moorhead_2
Frequent Advisor

Re: linux compressed print command

Thanks for the help.. unfortunately the text doesn't go the full width of the page and "word wraps" about 3/4 of the way over. I've tried all sorts of combinations of -o parameters, including columns=132, columns=80, fit-full-page, etc.

I ended up getting a file from a consultant that send some escape codes to the printer, that seems to work.

echo " E &l1O > /var/tmp/print.$$
cat $1 >> /var/tmp/print.$$
echo " E" >> /var/tmp/print.$$
lp -d$2 -c -s /var/tmp/print.$$
rm /var/tmp/print.$$

Matti_Kurkela
Honored Contributor

Re: linux compressed print command

Hmm, both on my little HP LaserJet 1300 and on Xerox printer/copier at work, a simple "lp -o cpi=16.66 testfile.txt" allows me to print a text file with 132 characters long lines with no lines wrapping and all the 132 characters visible.

Please identify the make and model of the printer you're trying to use for compressed printing. And, by the way, have you selected an appropriate PPD file for your printer in CUPS? Without a PPD file, CUPS works in "raw" mode - and that will prevent many of the options from working.

On some printers, you might have to specify all the required options explicitly:

lp -d -o cpi=16.66 -o columns=132 -o nowrap

(Note: all the examples in the CUPS documentation I've seen suggest that you must repeat the "-o" when specifying multiple options; specifying multiple options+values as a comma-separated list is not documented to work.)

But let's see what your consultant's file does:

The first "echo" command sends two PCL commands before the actual data to be printed. The first is E - a printer reset. This would nullify any formatting options CUPS might prepend to the job.

The second PCL command is &l1O - a command to set logical page orientation to Landscape, as opposed to the default Portrait.

The second "echo" command just sends the "reset printer" PCL command again. But that is sent after the printable data, so its only purpose is to make sure the printer is left to a sane state for the next print job.

I guess this is probably different from what the "-oc" option did on HP-UX, but if it's an acceptable solution for you, great!

MK
MK
Jason Moorhead_2
Frequent Advisor

Re: linux compressed print command

Matti,

Thank you for your input, it's much appreciated! The printer model is basically every printer we have set up (hundreds), which are all LaserJets, most using a postscript driver in Red Hat. And yes, the file is a plain text "raw" file. Sorry I didn't add that info.

I'll give printing another shot using all those options.

Thanks again!