This is a simple utility to convert a single page document to an form overlay for printing on HP LaserJet printers.
This was inspired by 'ovl' Hewlett Packard PCL Laser Overlay creation utility by Peter Hamilton, http://www.hamil.org/pcl/
This is a complete re-write with somewhat more sophiscated escape sequence parsing. I basicly stole his setup for the overlay macro and his list of sequences to delete from the stream.
Peter's original was distributed under the GNU Version 2, June 1991 General Public License. I don't know what that means for my re-write. I am imposing no restrictions on my version.
February 22, 2008 -- Added a windows command line executable. See the Files section below.
September 25, 2006 -- Added code to strip Printer Job Language (PJL) commands from input. Newer drivers for newer HP models (laserjet 4,5,6) may include these non-pcl codes which not compatable with overlays.
^[%-12345X@PJL COMMENT HP LaserJet 2200 Series PCL @PJL SET RET=ON @PJL SET ECONOMODE=OFF @PJL SET TRAY1TEMP=NORMAL @PJL SET RESOLUTION=600 @PJL ENTER LANGUAGE=PCL
Converts a single page document in HP-PCL to an overlay macro.
A form document is normally created by editing the form in your favorite editor (Wordperfect, msword, etc.) and printing it to a file (using a HP laserjet driver). This creates a file containing the raw printer commands for the form.
The raw printer codes are passed through pcloverlay to create an overlay file. The overlay file should then be sent to the printer ahead of data on which it will be overlayed.
Overlay macros are automatically invoked at the end of each page during normal printing. Therefore, during normal printing, whenever a page break is encountered, the commands in the overlay macro will be played back on top of whatever is already on the page.
-d will create debug output on stderr
Reads stdin and writes stdout
When printing, simply pre-pend the overlay form to your normal data stream. Ensure your data stream does not contain a printer reset command (ESC+E). It also shouldn't contain page orientation commands (ESC+&lnO).
Laserjet III drivers generate clean pcl that overlays well. Later lasterjet versions may include PJL codes (see news above) which are not compatable. The current version strips PJL codes but if you are having problems, try a laserjet III driver.
Color laserjet output from windows drivers seems incompatable. Windows drivers sometimes use the HPGL plotter commands to draw some graphics. This is not compatable with overlays. Some drivers (properties) have an option to force the use of raster graphics. I was unabled to find a driver/setting combination to work with color graphics in the overlay.
Parse PCL commands.
Remember any orientation command in the first N bytes (N is based on the output buffer which is currently 4096 bytes).
Delete certain commands inappropriate to an overlay macro
E Printer reset *r F Raster rotate image &l O Orientation (remembered) &l A Set page size &l H Set paper source &l G Don't know... Peter was deleting &l P Set page length &l S Simplex/Duplex printing &l X Number of copies
Output the macro setup commands
E Printer reset &lnnnO Orientation (nnn = 0-3) &f 1y Macro ID 1 0x Start macro def. 0S Push the current position. *r0F Raster orientation matches document
Output the form commands from stdin
Output the macro close and overlay enable commands
&f... 1s Pop the current position 1x Stop macro def 10x Make permanant 4X Enable overlay