pcoverlay.c--Convert a pcl document into an overlay file Kevin Smith/ShadeTree Software, Inc. 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. -- Kevin Smith, November 2001, kbs@shady.com Description Converts a single page document in HP-PCL to an overlay macro. 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. Usage pcloverlay [-d] 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). Processing 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 *rF Raster rotate image &lO Orientation (remembered) &lA Set page size &lH Set paper source &lG Don't know... Peter was deleting &lP Set page length &lS Simplex/Duplex printing &lX 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