please dont rip this site

Simple E-Forms Overlay via the Unix Print Driver

(some knowledge of Unix printing required)

Some Background

(Skip this section if you aren't worried about why we are doing the things specified in the following section)

Applications which run on Unix or Linux use the standard Unix "printer interface" files to add printer specific control codes to generic print data (the "print job") from applications. These files are actually executable scripts that are called to format the data and send it on to the Unix printer (on CLS this is shown on the left side of the Printer Setup screen) which is connected to a physical port somewhere. We can get the "overlay e-Forms command" control code to the printer by adding a line in these scripts that tells it to "print" that command to the printer with each print job. This will cause every print job sent to that printer interface to be overlaid with that e-Form.

If the developers of the application were forward thinking enough to make it possible to set up a separate printer interface for each printer and for each report that could be printed on that printer. So, for example, a printer called fdlas7 (the 7th LASerjet printer at the Front Desk) might be connected to a port also called fdlas7 and might have printer interface files called fdfol7, fdcls7 and fdreg7 (the 7th FOLio, City Ledge Statement and REGistration printers at the Front Desk) Any print jobs sent to these interfaces, end up printing to the same printer, but the jobs can be formatted in different ways appropriate to the type of form they are being printed with.

Step by Step

Log in to the Unix command prompt as the root user.

cd /usr/spool/lp/interface
and press the Enter or Return key. If you see a message that says something like "No such file or directory " try /var/spool/lp/

Make a backup copy of the printer interface file by typing cp followed by the name of the interface file for the report and printer you are setting up e-Forms on then a space then that name again with .bak after it and press the Enter or Return key. e.g.
cp fdfol7 fdfol7.bak

Type vi followed by the name of the interface file for the report and printer you are setting up e-Forms on and press the Enter or Return key. e.g.
vi fdfol7

Press the down arrow until you find the part of the program that looks like this:

# Loop through all the files passed, for the number of copies specified
while [ $copy -le $copies ]
	for files in $files
		cat /temp/soj.$user.$job $file /temp/eof.$user.$job | /opt/hpnp/bin/hpnpf -x $printer -N
		copy=`expr $copy + 1`

position the cursor on the "o" of the second "do" (the one under "for files in $files"), make sure Caps Lock is off and press the "i" key without holding Shift. The text "--- insert ---" will be displayed at the bottom of the screen.

Move the cursor one character to the right (so that it is after the "do") and press the Enter or Return key.

Press Tab or space keys until the cursor is just above the "c" in "cat /temp...". Use the Backspace key to backup if you make a mistake.

echo `\033&f21y4X\c`
for the Folio form or
echo `\033&f31y4X\c`
for the City Ledger Statement or
echo `\033&l4h3A\033&f41y4X\c`
for the Registration form. The difference here is a command to set the page size to Legal so that the entire Registration Key - Packet form can be printed and so that the printer will know that it needs to pull the form from the front tray.

Notice that the quote key used here is the single quote that slants. It is usually on the upper left most key on the keyboard along with the ~ symbol. The letter before the 33 is a zero rather than an "o". The letter before the "y" is a number one rather than a lower case "L". The case of the letters is important; the f, y and c must be lowercase and the X must be uppercase. It is also possible to confuse the forward and backward slash characters; the correct one is usually not the one on the question mark key but rather the one on the key with the "|" symbol.

Press the Esc key to make the "--- insert ---" at the bottom of the screen disappear and then type
and press the Enter or Return key.

You should see a message like
"/usr/spool/lp/interface/fdfol7" 75L, 1549C written
with the name of the printer interface you were editing, and different numbers before the L and C.

Now exit the command prompt and return to the application. When you print a job to that printer, the PCL command will be sent with each page and if the e-Form SIMM or DIMM is installed in the printer, and has that form available, the e-Form will now print. Even without the e-Forms installed, the printer will simply realize that the form is not available and ignore the command.

To test that these codes are correctly entered, change the \033 to \043 (the "+") and print a page (make sure you are using the correct terminal and printer) you should see +&f21y4X for the Folio (or +&f31y4X for the statement, etc...) printed on the first line of the report. Then change the \043 back to an \033 without deleting any of the other codes, and this text should no longer print. This shows that the sequence is being interpreted as a command, rather than printable text, by the printer. The fact that the sequence disappears indicates that it is most probably entered correctly.

Once the e-Form's are working correctly, you should probably go back and delete the backup files with the commands:
cd /usr/spool/lp/interface
rm fdfol7.bak

pressing the Enter or Return key after each command. Don't forget to type the .bak part!


See also:

file: /Techref/language/pcl/efpintnix.htm, 6KB, , updated: 2009/11/30 10:15, local time: 2018/2/23 04:46,

 ©2018 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF=""> Simple E-Forms Overlay via the Unix Print Driver</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2018 contributors:
o List host: MIT, Site host, Top posters @20180223 RussellMc, Sean Breheny, Van Horn, David, David C Brown, Isaac M. Bavaresco, Darron Black, Harold Hallikainen, alan.b.pearce, Brent Brown, John Gardner,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!