PCL Programming

I am having trouble with PCL printer programming and hope this isn't too specialized a topic.  We have - invoices, statements, purchase orders etc etc all continuous stationery for a multi company business and it is all getting out of control so -

I have been trying to get our lasetjet 2100 printers (we have about 10) to print "pre-printed" stationery with an "overlay macro" in PCL5 but cannot get the following data to print less the one and a half inches down the landscape form.  I can print the invoice on the laser perfectly and it starts printing right up the top of the A4 sheet as expected - beautifull!  I send an "overlay macro" and the invoices data prints about an inch and a half down the form.  I have tried to position the cursor in PCL before the macro, after the macro and both before AND after the macro without success.  I have tried the positioning in the HP/GL2 segment and using the exit Ec%1A and all sorts of combinations but cannot cause the invoice data to print any higher than 1.6 inches down the page.  I have included the "macro" below.  That little boxes are "escape's".

E            reset
&l1O         landscape
9            reset margins
&l2E         ditto
&f1Y         define macro 1
&f0X         start macro definition
%0B          enter HP/GL2
IN;           inialize
SP1;          select pen

the following coding draws boxes and lines

PA0,2100PD8400,2100,8400,4500,0,4500,0,2100PU;
PA3000,2100PD3000,4500PU;
PA3900,2100PD3900,4500PU;
PA4300,2100PD4300,4500PU;
PA5100,2100PD5100,4500PU;
PA6000,2100PD6000,4500PU;
PA6000,2100PD6000,1600,7000,1600,7000,2100PU;
PA7000,2100PD7000,4500PU;
PA7500,2100PD7500,4500PU;

PA0,7300;      position cursor
%1A           exit HP/GL2 with cursor  positioning
&f1X          stop macro definition
&f4X          enable overlay
&f10X         make macro permanent

If I send the invoice without the overlay it prints as expected.  If I send the above overlay first it prints too low.

I tried just print the word "INSERT".  Without the overlay it prints right on top.  With the overlay it prints 1.6 inches down the page.

I've tried ALL sorts of combinations, this is the last I tried.

Help!

louwin
louwinAsked:
Who is Participating?
 
spangler011300Connect With a Mentor Commented:
I don't have access to a LaserJet 2100,
so I tested on a LaserJet 4, using
"letter" sized paper.  For the basic
operations used here, they should be
compatible.

Taking the program you included in
the problem statement, line for line,
WITHOUT the comments ("reset",
"landscape", etc.), and with the
line "INSERT" as the last line, I
replicated your print behavior, with
about 1.68" from the top of the page
to the top of the word "INSERT".

I added the following 5 lines after
the "INSERT" line, to test cursor
positioning (where "<esc>" represents
the ASCII escape character):
---------- next line is first line added
<esc>&a00r00CX row  0 column  0
X row  1 column  0<esc>&a01r20CX row  1 column 20
X row  2 column  0<esc>&a02r40CX row  2 column 40
X row  3 column  0<esc>&a03r60CX row  3 column 60
<esc>&a20r01CX row 20 column  1
---------- previous line is last line added
This did result in printing where I
expected it, with about .35" from
the top of the page to the top of the
"X" in the "row  0" line.

You should be able to manipulate the
cursor position as shown before
sending your other data, or as part
of each line or field you send.

Please note that contrary to your
comment, you did not "reset" the
top margin with "<esc>&l2E", you set
it to line 2.  "Absolute" cursor
positioning after that is based on
top margin you have set.  If you
set the top margin to 0 and positioned
the cursor there, you could be in an unprintable area for your model of
printer.

If your use of HP/GL2 is just for
drawing boxes like those in the
example, that can also be done by
using PCL commands to print
rectangles - very narrow rectangles,
to draw rules.  Some older LaserJets
may not handle the program as written
- the "LaserJet III Technical Reference
Manual" mentions that "HP-GL/2 mode is
not supported in a macro".
0
 
louwinAuthor Commented:
Hello Spangler,

As you can imagine I continued to experiment and eventually got things to work.  As with the rest of the macro, pixel rather than column positioning, I used <esc>&a0h0V to position the cursor.

The real problem was the fact that each line in the original programming sequence ended with a line feed.  The printer was interpreting all the commands and after each was linefeeding.  I concatenated all the commands and Viola! everything started to work.

My printer (Laserjet 2100) does support HP/GL2 in macros but very unreliably.  Sometimes it would print the lines, sometimes (more often) not, so I had replaced the HP/GL2 with PCL alternatives.  I proved this by issueing the original commands as a normal print file and the lines ALWAYS printed correctly.  I then made it a macro only to have the lines NOT print.  I spent hours trying to get the HP/GL2 working before changing to PCL as a last measure.  I don't know why the HP/GL2 didn't work but that is now moot as PCL works fine.

I was having a lot of trouble getting a logo on the top left hand side of the page but am now following advice from my brother and doing ALL the overlaying etc on MS Word.  The problem with this method is that, in my previous experiments, the printer driver outputs PJL and I don't know how this will interface with the following data.

I have added this LONG comment to the solution to help any other poor @#$%^& who tries to do soemprinter overlay programming.

Thanks,

Louis
0
All Courses

From novice to tech pro — start learning today.