1832691 Members
2734 Online
110043 Solutions
New Discussion

Re: printer options

 
SOLVED
Go to solution
j773303
Super Advisor

printer options

How to adjust the A4 size, it means I want to print 50 rows
one page in the A4 while lp command to print the file.
Hero
17 REPLIES 17
Francisco J. Soler
Honored Contributor

Re: printer options

HI,

If it is a text file, you can try with pr -l50 | lp

You can use the printer options through the -o option in lp command

lp -o option

See the printer script file for more details. (/var/spool/lp/interface/printer_name)

Frank.
Linux?. Yes, of course.
Chris Vail
Honored Contributor

Re: printer options

Francisco is right about the pr command, but you might want to add the -n flag to suppress the header which would otherwise print. Its annoying.


Chris
j773303
Super Advisor

Re: printer options

I have try the pr -l50 test.txt | lp -d twn105, but I don't see the right result what I want. Is it the command error?
Hero
Francisco J. Soler
Honored Contributor

Re: printer options

Hi
What is the number of rows are you printing with the pr command?

What is now the problem?

Frank.
Linux?. Yes, of course.
Steve Steel
Honored Contributor

Re: printer options

Hi


Look at
lp -on -otl50 -ol54

You may get problems with the
hardware pagefeed on the printer.


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
j773303
Super Advisor

Re: printer options

The printer default line is 66. It is not enough for my ouput report. I'd like to have the 70 rows for A4 size paper.
Hero
Francisco J. Soler
Honored Contributor

Re: printer options

What is the printer model?

See the /var/spool/lp/interface/twn105
and check what option is right for you, then use the -o option, for example:

lp -ol070 or lp -otl070 -dtwn105


Frank.

Linux?. Yes, of course.
j773303
Super Advisor

Re: printer options

The model script is PCL5,
It seems -ol070 and -otl070
don't affect the page length.
But I try to modify PCL5 directly, chage the length='ln70', this is work. But if add -ol or -otl parameters with lp command, the result will failed.
Hero
Francisco J. Soler
Honored Contributor

Re: printer options

If you have the printer attached directly to your machine, you can try print directly to it.

pr -l70 text_file > /dev/lp_device

Frank.
Linux?. Yes, of course.
j773303
Super Advisor

Re: printer options

Is it possible set the printer control code in the front of the file which will printed? How to get the printer control code?
Hero
Francisco J. Soler
Honored Contributor

Re: printer options

Hi,
You can put the control codes with echo command:

For example to put an ESC character you can do:

echo "\033" > dest_file
cat your_file >> dest_file

where the number \nnn is in octal mode

Frank.
Linux?. Yes, of course.
Steve Steel
Honored Contributor

Re: printer options

Hi


You always need a page length text length difference


try

Look at
lp -on -otl70 -ol74

and if that isno good try adding -oc


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
j773303
Super Advisor

Re: printer options

I try the solution from above suggestion. It is ok in other model script, such as net_lj5x ...... But now the printer model script is PCL5, it is seems not compitable with
PCL5. I'd appreciate that someone could give me more suggestions.
Hero
Steve Steel
Honored Contributor

Re: printer options

Hi

PCL5 ?

What type of printer is it . How is it attached to your box.


See

http://www.hp.com/pond/modelscripts/

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Bill Hassell
Honored Contributor
Solution

Re: printer options

The PCL5 script is designed for locally connected printeres such as serial or parallel. If the printer is using an HP JetDirect LAN card, then PCL5 is not the correct script to use. You can add the printer using addqueue and it will pick the right model script:

/opt/hpnpl/bin/addqueue -h IP_address -q new_queue_name

Now it is important to test the row count with a plain ASCII fle (which is not a man page or some other preformatted file). The reason is that setting the printer options will not override imbedded formfeeds inside the print job. Use the /etc/profile or /etc/ntp.conf file as a source. They are fairly long and have no carriage controls inside the file.

You can easily create more lines on the page by adjusting the interline spacing with -ovsi as in:

lp -dprinter -ovsi8 /etc/profile

-ovsi can have fractional numbers like -ovsi5.67 for finer control over the line spacing. Note that this assumes that people are not 'playing' with the front panel defaults for the printer. Network printers should always be set to 100% defaults and each job then overrides these defaults. If a different font or line spacing is set in the printer, the script will know nothing about this.

Note that imbedding special escape sequences in the data stream works fine but you need to read (PCL5 tech ref) about the interaction between the font size, vertical spacing index, logical page length, etc. And these sequences are fine for the majority of HP LaserJet printers but may be incompatible with non-HP printers.


Bill Hassell, sysadmin
j773303
Super Advisor

Re: printer options

This is due to my customer company environment. It's hard to ask them to change the PCL5 script. Because the printed document will includeed electronic code, and PCL5 is still configuration for another application. BTW, the printer is HP laserjet 8100, but the model script is PCL5, I'd just want to know, is it possible to set the page length in PCL5 on hp laserjet 8100.
I have try to modify the PCL5 script directly, it is done. But due to the system still have the other application will use the printer. So, the best way is include the parameters in lp command. Is it possilbe to do this?
Hero
Bill Hassell
Honored Contributor

Re: printer options

The important question is whether the PCL5 script has already been modified. Use the diff command to compare the original PCL5 model in /usr/lib/lp/model with the current script in /var/spool/lp/request (or /var/spool/lp/request/model.orig if the LaserJet 8100 is a network printer). There is no problem with specifying different vsi values to get more lines on the page. The real question is whether the logical page has been modified in the script. If it was not done correctly, then attempts to override the new value may fail.

If the PCL5 script is non-standard, you have anotgher choice if the printer is on the network with an HP JetDirect card. You can create another printqueue with the standard net_ljx000 script and then use the -o options as needed. NOTE: this assumes that the datafile you are rpinting does not have any PCL codes of formfeeds already in the file.


Bill Hassell, sysadmin