apl logo

A.P. Lawrence

Information and Resources for Unix and Linux Systems
Bloggers and the self-employed
RSS FeedsGet APLawrence.com by RSS





Printer Friendly Version


(OLDER) <- More Stuff -> (NEWER)

pcloverlay--Create forms overlays for Lasterjet PCL printing by Kevin Smith

Kevin Smith of Shadetree Software has allowed us to mirror this from his site.

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.demon.co.uk/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.

Description

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.

Usage

pcloverlay [-d]

-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).

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

<esc>E                  Printer reset
<esc>*r<n>F             Raster rotate image
<esc>&l<n>O             Orientation (remembered)
<esc>&l<n>A             Set page size
<esc>&l<n>H             Set paper source
<esc>&l<n>G             Don't know... Peter was deleting
<esc>&l<n>P             Set page length      
<esc>&l<n>S             Simplex/Duplex printing
<esc>&l<n>X             Number of copies

Output the macro setup commands

<esc>E          Printer reset
<esc>&lnnnO     Orientation (nnn = 0-3)
<esc>&f
     1y         Macro ID 1
     0x         Start macro def.
     0S         Push the current position.
<esc>*r0F               Raster orientation matches document

Output the form commands from stdin

Output the macro close and overlay enable commands

<esc>&mp;f... 1s Pop the current position 1x Stop macro def 10x Make permanant 4X Enable overlay

Files


Comments /KevinSmith/pcoverlays/index.html


Tue Feb 20 15:58:21 2007   anonymous

As at Feb 20, 2007, thing utily does not appear to function as indended,
as the resultant overlay file generates PCL XL errors


Thu May 10 21:23:39 2007 I got it to work after a slight modification  JimYoung

It didn't work for me the first time either but when I removed the UEL
string ("<esc>%-12345X") from the overlay file then it did work.
There were UEL strings at both the beginning and the end of the file. I
have a short code patch to fix that problem.

Jim Young
Jim.Young at cerner dot com


Fri Apr 11 09:35:17 2008 tip  wg

Website:
To avoid problems with PJL commands ( and -12345X ), when creating your
prn file on windows: Use the windows standard driver hplaser and print
to file, then move it to linux.


Add your comments



Related Articles

Have you tried Searching this site?

Please read this disclaimer

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.