Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to change margins and spacing

Status
Not open for further replies.

henningp

Technical User
May 2, 2012
15
0
0
US
We are trying to change the margins and spacing and when we add those specifics, nothing changes. this is what we are using right now: ^[&l5E^[&a1L^[&a1M^[&l9D^[&l1O^[&k2S

We are new at this and have gotten things working with just the landscape and size:^[&l1O^[&k2S

but no changes when things are added. Any help would be appreciated.
thanks!
 
You have an incomplete page format command. Forget about the
l/r margins for the moment.

This is letter size paper?

You are appareently looking for a landscape page @ 9 lpi
with a top margin of 5 lines and presumably a bottom margin
of 5 lines as well. Correct?

Try a code ...

^[&l2a1o9d5e63F

that is <esc>& ell 2a 1o 9d 5e 63F
Report back.


Jim Asman
 
Just to make things a bit clearer, and assuming that ^[ is the method used by the source application/operating regime to represent/generate the (non-graphic) control-code Escape character (the character with decimal code 27, or hexadecimal 1B, or octal 033):

Original sequences:

Code:
<Esc>&l5E         Top Margin (5 lines)
<Esc>&a1L         Left Margin (column 1)
<Esc>&a1M         Right Margin (column 1)
<Esc>&l9D         Line Spacing (9 lines per inch)
<Esc>&l1O         Orientation: Landscape
<Esc>&k2S         Pitch Mode: Compressed (16.6 cpi)

Jim's sequences:

Code:
<Esc>&l2a         Page Size: Letter
       1o         Orientation: Landscape
       9d         Line Spacing (9 lines per inch)
       5e         Top Margin (5 lines)
       63F        Text Length (63 lines)

Potential problems with the original sequences:

- The right margin and left margin are both set to column 1.
... and the width of these 'columns' is defined by the current HMI (Horizontal Motion Index) which is set in various ways, including (I think) the 'Pitch Mode' sequence (which is considered to be obsolete on modern PCL5 printers).

- The 'Set Top Margin' sequence sets a margin in terms of lines spaced at the current line spacing; as this sequence is the first, it will probably use the 'power-on default line spacing.

- The 'Set Orientation' escape sequence resets (amongst other things) the top, left and right margins to their 'user-default' (power-on) values, thus effectively ignoring the values just set.
 
I changed what I had, but it seems that all it did was print portrait instead of landscape and it didn't do anything with the spacing. I'm sorry for being so clueless at this. I have this in the file: ^[& ell 2a 1o 9d 5e 63F
 
The code with the spaces was posted just for clarity. You should put ^[&l2a1o9d6e63F into your setup. Note that the ^[ represents the single character 0x1B as dansdad pointed out.

Jim Asman
 
This is still printing very large. How do we make the font size smaller?
 
First, what printer do you have and what operating system are you using?

For the moment, we will select 16.67 pitch courier by adding the following to the page formatting code:

^[(s0p16.67h0s0b4099T

Try that and report back.

Jim Asman
 
I'm not sure of the printer, but the operating system is linux. Do we add: ^[(s0p16.67h0s0b4099T after what we already have or do we incorporate 16.67 into what we have:^[&l2a1o9d6e63F

Sorry I'm so bad at this and thanks!
 
so with this information,^[&l2a1o9d6e63F^[(s0p16.67h0s0b4099T
We are getting a first page with printed garbage and then the next page doesn't have any change in the text size. It is still very large.
 
When we do this, the print is very large and runs off the right side of the page. Any idea?
 
Make sure the job begins....

^[E^[&l2a109d5e63F^(s0p16.67h0s0b4099T^[&k2G

All PCL print jobs should begin with ^[E a ptinter reset so add it if it is not there now.

The last command will cause the printer to supply add a CR to the LF character which isn't normally supplied with Linux text files.

BTW, are you using vi/vim to create the file?

If that does not work, email the file to me at:

jimATspectracolorservices.com

change the AT to @ as appropriate in the email address




Jim Asman
 
>> we are using vi to create the file

Yukk!


>> I'm not sure of the printer ...

If the printer doesn't support PCL5, then the PCL escape sequences as per above won't work, and the effect is undefined.


Attached a small sample file, based on the escape sequences suggested by Jim, with some text and form feeds added; it should print three landscape pages, each with two lines of (up to) 132 characters as the first two (logical) lines of the page.
 
 http://www.mediafire.com/download.php?b73nn36nc90v3jq
>>> we are using vi to create the file

>>Yukk!

I disagree! ;-)

The vi clone supplied on Linux systems called vim, that has a binary mode is quite suitable for developing pcl code, and is available for DOS and unix systems as well. For me it is the editor of choice to use in creating pcl forms from scratch.

It allows line lengths of 20K+, which if it didn't, would make it impossible to edit files that contained even a small image. You can run shell scripts directly to insert new code into the file. I can generate the generate the pcl code to produce boxes with rounded corners, successive lines equally or randomly spaced across or down the page. It provides a mechanism to insert 8 bit characters into the file. Additionally, the global substitutions and deletes are VERY useful.

Now the original "vi" will not work at all. It swallows 0x00 characters, and if you edit a file containing null characters such as a raster image, they will be deleted when you save the file and the image corrupted. It will error out when a line length exceeds a certain character length.

The list goes on...






Jim Asman
 
Jim

Each to their own!

I first used vi (or something like it) on a unix clone running on PERQ hardware in late 1970s / early 1980s (can't remember exactly when) and (my main job then being on (non-IBM) mainframes) was appalled at how primitive it all seemed.
I was then forced (reluctantly) to use it again on System V Release 4 systems in the early 1990s.

... but your comment about <NUL> characters was the main reason for my exclamation.

I'm not familiar with vim as I've been almost exclusively Windows-based for the past 15 years or so.

I use a hexadecimal editor where I can see EXACTLY what the character (codes) are, without having to remember arcane 'substitutions' like ^[.
 
so would you assume that it isn't PCL5 since the commands you recommended didn't work? I assumed it was based on what we had to start with that worked fine, we just needed to add more to it. Is there not simple command for landscape, small print, 1 inch left margin, 1 inch top margin, single spacing? I really appreciate everyone's help!
 
I haven't got any idea as to what has worked and what hasn't worked.

There was a reason why dansdad asked you at the very beginning what printer was being used and what OS was involved.

If you will send me or attach the file you have so far I will look at it and see what it wrong. Any PCL printer should respond to a properly defined landscape page. Maybe you have some kind of a windows only printer that will respond to pcl code only to the point of simple text in portrait mode.

Unyil we know the environment, we can't really tell you very much.

Jim Asman
 
things are starting to look right, but we are still having some problems with the spacing. It is showing up as double spaced. Is there any way to make it single spaced?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top