[Back to Home Page]

Hewlett Packard PCL Laser Overlay creation utility


Please note that i no longer have access to HP printers, so cannot support this software. You might find it useful, but if it doesn't work with the latest laserjets, i can't help you, sorry.

OVL - Create macro overlays for Database programs

Usage
History
The Algorithm
Changes & Bugs
Compiling
Special Thanks

Also see Kevin Smith's version, a complete rewrite with he says: "more sophiscated escape sequence parsing" (haven't tried it yet, but it looks good...).

Source Code - ovl.zip version 2.2 (Nov 1999) (27Kb) (A prebuilt DOS .exe is included). This new version allows you to specify the macro ID number. Just run the program for help. Sorry I don't have time to update the documentation at present.

THE PURPOSE OF THIS PROGRAM

To create Overlays (graphical forms) for Database programs.

This program was orginally written for a Corporate Database report generating system.

To avoid using expensive pre-printed laser forms, the graphical form is printed on plain paper. When printing hundreds of invoices (for example) it is becomes very slow if the graphics are printed repeatedly. Laserjet macro overlays allow you to send the graphical part of a printed form once to the printer and have it repeat on every page automatically.

A form is created in any graphics program capable of printing to a Laserjet such as Corel or FormFlow and converted by OVL into an Overlay.
This overlay is sent to the printer and stored in printer memory as a macro. Each subsequent page printed will now have the overlay in the background.
The overlay will stop printing when a reset command "<esc>E", disable automatic overlay "<esc>&f5X", or one of the delete macro commands are issued.
This program supports HP Laserjet printers 3, 4 and 5 series and can produce landscape and portrait overlays.

Usage

  1. Create the form in any graphics program capable of printing to a Laserjet printer. Try to use printer fonts rather than Truetype fonts, as the size of the resulting overlay will be *much* smaller. If you use Truetype fonts, a "- Warning! contains Soft Fonts" message will be displayed.
  2. Print the form to disk. This will be a laserjet file containing PCL escape sequences.
  3. Convert the print file to an overlay with the command: OVL InputPrintFile.prn OutputOverlay.ovl
  4. Thats it.

You can then send the overlay to the printer.

Normally, unless the default printer font is OK, you will want to specify orientation, lines per inch and characters per inch, e.g.:
<esc>&l0O<esc>&l6D<esc>(s10H
specifies portrait, 6 lines per inch and 10 characters per inch (<esc> is 1b hex). Send these codes to the printer after the overlay.

Then send each page of report data followed by a form feed (0C hex). the overlay will appear on the background of each sheet.

For an example print file, printer font file and alignment test sheet, see the example directory.

[back to top]

History

The original to this program was written back in 1993 in assembler. Rewritten in C in 1996 for greater portability and released under GNU General Public Licence. See the file COPYING for details. The binary enclosed is for DOS, but the source code is included for those wishing to recompile for Unix/Linux/NT/OS2/Mac.

[back to top]

The Algorithm

Search ahead in the file (first 256 bytes) and record the following:
<esc>&l1o - portrait or landscape

The following header is added to the start of each overlay:
"<esc>E<cr>" + "<esc>&l0O<cr>" + "<esc>&f1y0x0S<cr>" + "<esc>*r0F" + "<esc>&l4d1E"

(the <esc>&l0O may be <esc>&l1O for landscape)

And the footer is added to the end:
"<esc>&f1s1x10x4X<cr>"

SPECIAL PJL/PCL - Some PJL/PCL commands must be deleted under certain conditions:

Form Feed (0xc) Delete if in last 16 bytes of file.
@ sign Indicates a PJL command, delete up until next escape character if "@" is in first 16 bytes of file.
<esc>E (0x1b+"E") Printer reset, delete.
<esc>*r0F Raster graphics presentation mode, delete.
<esc>%-12345X Start of PJL language, delete.
<esc>&l5X Where 5 is 0..999 and X is A,H,G,O,P,S or X, delete.
<esc>&lxxxxxX Multiple command, where x is any character or digit, and X is any uppercase character. If in first 0x100 bytes of file, delete (max 20 chars).
<esc>)s If followed by "W" within 6 bytes, we have a soft font. Allow this, but print a warning.

[back to top]

Changes & Bugs

If you have any suggestions for modifications, enhancements or just want to say you found the program useful, drop me a line.

The program has been thoroughly tested, but if you do find any bugs, please let me know.

Compiling

If compiling under DOS, compile as large model. If you haven't got a compiler, contact me and I'll send you an exe.

Special Thanks

To HP for producing great printers (but come on HP, do you have to charge UKP 120 for a reference manual !?!!). Phil Best at Higgs & Hill Computer Services for putting up with endless questions. Julian Howarth at CSB Limited for help with the landscape codes.

[back to top]


Last Update - 19 April 2000.