Meaningless Drivel is fun!
The moose likes Linux / UNIX and the fly likes Setting printer paper length using unix commands Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Setting printer paper length using unix commands" Watch "Setting printer paper length using unix commands" New topic

Setting printer paper length using unix commands

karthik Suryanarayanan
Ranch Hand

Joined: Oct 07, 2009
Posts: 121

Hi Guys,
I have been trying to resolve a printing problem but nothing works out .
I have an Epson LQ 680 (dot matrix printer) . I need to print a file . The paper length should be 34 .Left margin should be 5. I have tried the following things after researching from the man pages.

But in both these cases i get a problem where in the first page is printed properly but the second page and pages after spits out blank lines and it doesn't obey the page length .
My other case was

where form feed characters are read properly and aligned but the printer takes default length of paper size as 66. I need to override this paper length settings through shell script whenever i print.
Since other applications use the same printer i can't set the page size in the server .

I am using HP - UX , Bourne Shell.

I heard that we can echo the printer settings in unix.I have the printer codes in Hexa decimal values. (\x1B\x43\x21)

Have tried using

But nothing is working.I am a newBee to Unix .

Any help on how to echo the printer page length dynamically using any unix commands .

"Learning is a Culture where your Eagerness & Curiosity plays a major Role".
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17260

If you're using a continuous-form (fan-fold) printer - which it certainly sounds like you are - you are very likely running into a conflict between printer options and OS options on page length.

A lot of printers featured an automatic skip-over-perforation function designed to permit printing long continuous sets of lines while automatically jumping over the perforated section where you tear pages apart, since otherwise you'd end up with half a line on one page and the other half of the line on another page.

So if the OS is attempting to manage the page size AND the hardware (printer) is attempting to manage page size, chaos is the outcome.

Fortunately, the skip-over-perf option can usually be be switched off by adding the appropriate control sequence to the printed output. Or occasionally by running a software or hardware utility (in some cases, flipping a DIP switch on the printer). That's vendor-dependent, so consult the printer's instruction manual.

An IDE is no substitute for an Intelligent Developer.
karthik Suryanarayanan
Ranch Hand

Joined: Oct 07, 2009
Posts: 121

Thanks for the reply. Have tried that option. Still i'm getting the same issue. Any other possible solutions through Unix ?
karthik Suryanarayanan
Ranch Hand

Joined: Oct 07, 2009
Posts: 121


I have tried using this following echo commands .

I am really not sure about this syntax since it did not reflect any changes in my printing. Have browsed google but was not able to find any type of examples for this.

Have tried the following.

How should i echo the printer codes to the printer from Unix. Whether i need to echo the printer codes to ?

I agree. Here's the link:
subject: Setting printer paper length using unix commands
It's not a secret anymore!