My Account  |   Track Order  |  View Cart

Electronic Forms Integration with Unix based systems.

Some Background

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

PMS systems that run on Unix and uses 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 (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. You can view and adjust this configuration by selecting option "14 - Database Maintenance" from the main menu then "31 - Spooler Menu" and finally "2 - Printer Setup"

The makers of Galaxey were forward thinking enough to make it a policy 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 Ledger 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" >> /tmp/soj.$user.$job
for the Folio form or
echo "\033&f31y4X\c" >> /tmp/soj.$user.$job
for the City Ledger Statement or
echo "\033&f41y4X\c" >> /tmp/soj.$user.$job
for the Registration form. 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 Galaxey 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!


The /c at the end of the echo command suppresses the newline character normally added by echo.

The \033 is the escape character expressed in octal rather than decimal (27) or hex (1b). Is a much more complex version of a printer driver that shows some of the same techniques.