Formerly Tid Bytes, the TRZ offers tech notes from the field written by BASIS Technical Support personnel. This regularly appearing column features practical answers to the real problems developers face on the frontline of getting their systems up and running.
Configuring Printers In PRO/5 Using Escape SequencesBy Nick Decker
The PRO/5® language runs on a variety of platforms while maintaining program and data file compatibility on each operating system. Additionally, it is able to communicate effectively with a multitude of different printers. It does this by using escape sequences, sequences of characters containing coded instructions for the printer and preceded by an ESCAPE character (ASCII code 27) to get the printer's attention. Escape sequences are also known as PCL (Printer Control Language) codes and are supported by most printers. One of the great benefits using escape sequences is that you can take advantage of any feature that any printer has to offer by configuring it via escape sequences.
What can I do with escape sequences?
By telling PRO/5 which escape sequences to send to a printer, you can configure the printer's page size, font family and point size, rows and columns, etc. The only challenging part is finding out what escape sequences your printer utilizes to manipulate these features. For example, different printers use different escape sequences to set the page size, so the escape sequences can be unique to each printer. However, many families of printers, such as Hewlett Packard's HP LaserJet series, tend to share the same escape sequences. The printer's manual should detail all of the escape sequences that it supports. Additionally, many printer manufacturers make their printer escape sequences available via their Web sites.
How do escape sequences work?
PRO/5 uses a printer alias line in the
The hexadecimal string of numbers is a series of the escape sequences that PRO/5 sends to the printer when you want to print compressed print. Here's an explanation of the CP mode (which is specific to the LaserJet):
These sequences are taken directly from the HP LaserJet manual. The
only difference is that PRO/5 expects the escape sequences to be in
hexadecimal on the alias line, while some manuals list them in ASCII
or octal representation. For example, a printer manual may say that to
cause the printer to set the page length to 60
If I don't have the manual, where else can I find the specific escape sequences for my printer?
It's possible to get the escape sequences for some printers by printing out the test print pages provided by the manufacturer. But as is often the case, the Internet may have a solution to your problem. For example, Hewlett Packard offers Printer Configuration Wizards on its Web site that allow you to fill out a form describing how you want your page to look. These Wizards then return the ASCII version of the escape sequences you need to use to get your desired look. This way, you can bypass the manual, but you'll still need to convert these ASCII escape sequences to hexadecimal if you want to use them in PRO/5 printer aliases. These Wizards can be found at the following URLs:
For an HP LaserJet model:
Copyright 1999, BASIS International Ltd. All rights reserved.