Operating System - HP-UX
1833877 Members
1654 Online
110063 Solutions
New Discussion

Re: Printing in Unix: Setting Margin...etc

 
Son Le
Frequent Advisor

Printing in Unix: Setting Margin...etc

Hi everyone, can someone tell me how to set the margin when printing in unix. I am trying to print a file with the corresponding margin value:

- 10 character per inch monofont

- top and bottom margins = 1/2 inch

- 6 lines per inch

- 66 lines per page

can someone tell me how to set that up? this is what I have in the following printer script:

dd_i2p=">lp -dis2 -s -onb -ovsi5 -otl66 -olpi6 -ofp10 -oportrait"

export dd_i2p

I would appreciate any help in this....thanks.



10 REPLIES 10
James R. Ferguson
Acclaimed Contributor

Re: Printing in Unix: Setting Margin...etc

Hi:

Use 'pr'. For instance:

# pr -F -o16 -l66 filename|lp -d myprinter

...would place the title of
Regards!

...JRF...
Son Le
Frequent Advisor

Re: Printing in Unix: Setting Margin...etc

that didn't work...do you know a way to set the top and bottom margin on the printer?? i have a HP LaserJet 5SI..I read the manual but it doesn't say anywhere in there about setting the margin...i see how to set the lines and the pitch but thats about it. Any help is much appreciated. Thanks
Bill Hassell
Honored Contributor

Re: Printing in Unix: Setting Margin...etc

Several of your options overlap each other. -ovsi5 sets the interline spacing but -olpi6 sets 6 lines per inch in the current font and -otl66 sets a logical page size which may or may not produce the same results. So I would pick one or the other to set the spacing between lines. I would recommend -ovsi since you have very fine control (ie, -ovsi6.125) over the line spacing.

To set the margins, use -olm, -orm and -otm for left-, right- and top-margins. Note that the units of measure are in columns and lines for the current font. Oops! The printer processes each option in order so you should always select the font and pitch first, then the vertical spacing increment (-ovsi) and finally the margins.

To see all the options, look at the man page for net_lj5x (I am assuming the 5Si is connected on the network using an HP JetDirect card and the model script is net_lj5x. If the printer is a remote printer connected to an PC, none of the -o options will function.


Bill Hassell, sysadmin
Son Le
Frequent Advisor

Re: Printing in Unix: Setting Margin...etc

Hi...yes that works for me, i tried what you told me but the 2nd page and so on doesn't keep the setting. How do I make it so that it keeps the setting on each page.
Son Le
Frequent Advisor

Re: Printing in Unix: Setting Margin...etc

any help on keeping the setting for each page??
Son Le
Frequent Advisor

Re: Printing in Unix: Setting Margin...etc

any news on this?
Bill Hassell
Honored Contributor

Re: Printing in Unix: Setting Margin...etc

Sorry, I did not notice the new question. The settings work fine on plain ASCII files. Print something like /etc/distab and the settings (like lines per inch) will remain the same. However, if you have a program that is a bit too smart, it may be issuing an ESC E just before each new page and this tells the printer to reset all of it's values. To see this, you''ll need to take the printer output of the program into a file and use cat -v to see if there are PCL control codes imbedded in the file. These will have to be removed since HP-UX does not filter anything inside a print job.


Bill Hassell, sysadmin
Son Le
Frequent Advisor

Re: Printing in Unix: Setting Margin...etc

when i vi the file, it has alot of ^M which i assume are return or enter. So it would read something like this"

^M^L^M
^M
^M
John Doe
2847 5th Street
^M
^M

and so on and on and on. Would the M or the L cause a reset?
Bill Hassell
Honored Contributor

Re: Printing in Unix: Setting Margin...etc

^M is a carriage return which means the file was not created on a Unix system. DOS/Windows creates ASCII files with CR+LF as record terminators while Unix just uses the single LF carcter. The ^L character is a form-feed which causes the printer to eject the current page. Neither of these characters will reset the printer's settings.

cat -v will show imbedded escape sequences. What happens on page 2 and beyond when you print /etc/profile or /etc/ntp.conf? How is the printer connected? (serial, parallel, HP's JetDirect card, some remote print server?)


Bill Hassell, sysadmin
Son Le
Frequent Advisor

Re: Printing in Unix: Setting Margin...etc

the file was created inside UNIX using a third party software. The printer is connected on the network using hp jetadmin