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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Beginner - Macros and Overlays?

Status
Not open for further replies.

zerowalker

Programmer
Nov 25, 2019
5
SE
Hi,

i hope this forum is the right place, it's really hard to find anywhere to ask about PCL.


So to start with, i am really new to PCL, i understand some stuff from reading the instructions/commands available, but i can't really read PCL that well if it's not very basic.

Now to the thing i want to learn.

Macros and/or overlays, i think they are connected.

I got a "template" of sorts that i am trying to alter, it has some forms drawn that's used for multiple pages and the only thing that differs is the data.
I can see that that the "forms" are set at the start, and it seems to be with macros somehow, but i can't really tell when it starts/ends,
it doesn't really work out if i compare it to the macros instructions (i can't find f0x for example).

So i want to learn how one does such an overlay like that (meaning a form that's on every page, be it a line, a logo or whatnot) without actually copy pasting it on each page.

Thanks:)
 
What you are looking for is known as an "automatic overlay". The AO is simply a PCL macro
that is enabled as an AO. It works like this.

<esc>&f0X Declare macro definition
macro code Macro contents
<esc>&f22y1X End macro definition (1X) Assign macro ID of 22 (22Y)
optionally add
<esc>&f22y10X

This will declare macro 22 to be permanent, which means that the macro will remain in
printer memory until it is specifically deleted or the printer is power cycled. This file
is first sent to the printer. Now when the data is subsequently sent to the printer you want
to enable macro 22 as the AO. Preface the data with <esc>&f22y4X and you will have the macro
run on every page. Note that the AO will be disabled by a printer reset. <esc>E

If you want I will look at what you have now. You can the email address from my website.






Jim Asman
 
I strangely enough just tried that and got it working, precisely as you explain here!

It was basically just luck trying to mimic the other code, but i noticed that it actually worked, thought i had tried it before with no luck, must have missed some step.

So the &f#y#X is probably what has confused me, i think the info on instructions explains it like it was 2 separate instructions.
"Start, End" etc, not "Start this, end this", i thought the ID part was it's own thing i guess.

But what does the permanent thing do compared to non-permanent, is the non-permanent "page bound" perhaps?
As i thought the &f22y4X would be the thing that sets the overlay.



The point of this is for a logo, and maybe you know a way to get some svg image into pcl?
i currently did a trick by printing it to a file and messing around with the pcl/gl2 code to get what i want,
but it's not ideal as it's basically a Page that i try to offset to the right place rather than actually being just the logo.
I did actually get it quite good though, but it's very hackish, i just know it looks kinda right from tests, but it's clearly not handled "correctly";P
 
> The point of this is for a logo, and maybe you know a way to get some svg image into > pcl?

That is exactly what my MKPCL program does. It only supports BMP, PCX, and JPG
though. Go to the website and download the demo for your OS. Play with it a bit and
come back with questions.

> i currently did a trick by printing it to a file and messing around with the
> pcl/gl2 code to get what i want, but it's not ideal as it's basically a Page
> that i try to offset to the right place rather than actually being just the logo.

You can embed positioning codes into your pcl image fie if you want. The point of making the macro permanent would be to allow you to send the macro file to the printer before the print job itself. Heck, you could send it to the printer first thing in the morning, and as long as the printer wasn't power cycled it would still be resident in the printer. You still need the AO enable command within the data.

> I did actually get it quite good though, but it's very hackish, i just know it looks
> kinda right from tests, but it's clearly not handled "correctly";P

You can get quite clever with this stuff. Years ago we did a work order form that had on the order of a dozen or so different forms, but would only would use six or seven of them in any one order, which depended on the requirements of the order itself. Each of the forms had its unique ID, so logic in the program would call the appropriate macro. Twenty years later they are still using it. All the macros were assembled into a single file and sent to the printer at the head of the job.

One thing to remember is that an overly exists in its own environment and can have its own margins etc. separate from you data. Let's say you want to print the logo above the top margin of your data page. Easy in an overlay.



Jim Asman
 
jlasman said:
That is exactly what my MKPCL program does. It only supports BMP, PCX, and JPG
though. Go to the website and download the demo for your OS. Play with it a bit and
come back with questions.

Quite expensive application, but will check it out!

jlasman said:
You can get quite clever with this stuff. Years ago we did a work order form that had on the order of a dozen or so different forms, but would only would use six or seven of them in any one order, which depended on the requirements of the order itself. Each of the forms had its unique ID, so logic in the program would call the appropriate macro. Twenty years later they are still using it. All the macros were assembled into a single file and sent to the printer at the head of the job.

One thing to remember is that an overly exists in its own environment and can have its own margins etc. separate from you data. Let's say you want to print the logo above the top margin of your data page. Easy in an overlay.

I think that's what this one does, cause looking at it, it has a ton of stuff that's not used in our case.
And i noticed when messing around (removing stuff as i tried to figure out where the logo was before) i enabled some other forms.

Really neat, but i find it impossible to read it, it's just too complex of a language for me, but i am guessing one usually has some kind of handler that generates it.


Quite interesting though.
I kinda want to buy some cheap printer to have at home to play around with, do you have any recommendations?
I would like it to support Postscript and PCL5 and 6 i guess, that's like everything right?
I don't care much for what the printer can do as long as it's can handle A4, but if it's good quality and other functionality that's of course a bonus:)
I am guessing i want laser unless it's perhaps much more expensive (i really don't know much of printer costs nowadays).
Color is a bonus, if it's a small difference in price i am willing to get it just for fun.

I am guessing it might not be that easy to recommend one, there's probably a billion and all have their uses and problems, but doesn't hurt to ask:)
 
I haven't looked at printer prices for years, so I can offer little advice. Beware, though, that often the inexpensive color laser printers come with minimally filled toner cartridges and the replacements cost more than the printer. I would make sure that any printer purchased supports PCL5, PCL6, and Postscript.

Be aware that PCL6 is NOT a superset of PCL5. PCL6 is essentially compiled object code which is generated by the printer driver while PCL5 is interpreted on the fly. So any PCL5 code you may have means nothing in the PCL6 context. Likewise Postscript.

Jim Asman
 
Thanks, will make sure it ssupports all those and try to make sure it's cost effective somehow!:)
 
If you are trying to modify an existing overlay, consider that some text could actually be an image and not raw text. Often a page may be made up from several different images. Also, if the PCL5 was generated by a windows printer driver you may find text is unrecognizable as it has been remapped to different characters via a custom symbol set. Rather than a printer, you might look at a PCL viewer, whereby you can view it on the screen without printing it. There is a free one from CoolUtils. Do be aware, however, these programs ALL have their own deficiencies that you learn to work around. Swiftview is one of the best I have tried, but it costs several hundred dollars.

Jim Asman
 
Just to add to the excellent information that Jim offered ...

If you purchase a printer with some type of non-volatile storage (Flash DIMM/SIM or hard drive), you can store your most commonly-used macros in the "0:\pcl\macros\" directory on its PJL/FSA file system and call them from there.

That allows you to dispense with having to send the entire macro jobs to the printer after every reset or power-on/power-off condition.

I use older LaserJets that use Flash DIMM for this, but I believe the newer models allow for USB storage that would work just as well (if not better) for this purpose.

In addition to macros being stored in the non-volatile memory, you can also store fonts (in the "0:\fonts\" directory) that can be accessed from PCL.

There are a number of ways to access the printer's PJL/FSA file system to upload macros and fonts. These days the most common method employs HP's Webjet Admin 10 program.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top