PCL2ENGLISH Version 2.0 Author: Allen Norskog September 15, 1990 PUBLIC DOMAIN NOTICE This program is placed in Public Domain. It may be freely copied. I developed this program to suit my own needs. I hope it will be useful to others. The source is included so that you can make modifications to suit your own needs. I would appreciate any comments or bug reports. DESCRIPTION Pcl2english was designed to help debug and understand printouts that use the Hewlett Packard Printer Control Language (PCL). For example, when pcl2english encounters the "escape sequence" for setting the margins, it will print out the escape sequence that was used and a brief English translation of what it means. I have frequently done this process by hand and its quite tedious. First one (typically) prints the characters out in hex so that the "escape" character, 1B (hex), can be seen. By slowly going back and forth between the hex printout and the printer manual, you can decode the escape sequences and start to determine what the printer was asked to do. Pcl2english was designed to reduce the tedium and chance for errors with this formerly manual process. You will still need to use your printer manual to more clearly understand page size, margin settings, font selection and your printer's capabilities. But hopefully, you can quickly answer questions such as: Why did part of my print out come out on the second page? It has been my experience that each program seems to have its own philosophy of how to print. Pcl2english is a tool to understand these "philosophies" and give insight as to when you can get a program to do something you want (say print in landscape) and when you can't. I have personally used a number of the Hewlett-Packard printers: ThinkJet, DeskJet, PaintJet, LaserJet+, and the LaserJet IIP. The program handles the escape sequences used by these printers and also the LaserJet 500+, DeskJet+, and LaserJet IID. Pcl2english does not handle new features introduced with the LaserJet III. REVISION HISTORY Version 1.x: Internal development versions. Version 2.0: First release of pcl2english. RUNNING PCL2ENGLISH Pcl2english is strictly a "text" based program. The command format is: pcl2english [options] infile [outfile] options: -e print escape sequences and certain control codes only. Normal text sequences are not printed, though they are used to keep track of where the "cursor" is. -v print version number on the first output line. -x print hexadecimal equivalents. After the escape sequence, special character, or line of text is printed, a line is printed that contains the hex values for each character. infile: "pcl" input file. This should be a capture of the exact data being sent to the printer. That is, any data translation ("cooking") should have already been done. Methods to get this will vary with machine/operating system. outfile: optional output file. If not given, output is sent to stdout. The output is plain ASCII text. PCL2ENGLISH OUTPUT A short example to illustrate various features follows: (s10h1T (s10h primary font characters per inch = 10 (s1T primary font typeface = Pica &d@ &d@ Disable Underline (sbS (sb primary font weight = Medium (0) (sS primary font style = Upright 9 9 Reset Left and Right Margins to default settings. &l002e062F &l002e Top margin = 2 lines. Text length defaults to: page_length - top_margin - half_inch &l062F Text length = 62 lines 1234 Added 4 more lines.
Move to first line at top of next page while maintaining current column at 4. Added 1 more lines. ---------------------------------------------------------------------- Special characters are enclosed in <>'s such as the escape and form feed. Each new group of special characters is printed starting at the left edge. Multiple escape commands can be grouped together. The actual decoding for each "sub" command is done on subsequent indented lines following the command group listing. The (sbS command above is an example of this. Text is condensed to fit on a single line. This is done by printing up to 20 characters. If more than 20 characters were encountered, the first and last 10 characters are printed separated by " ... ". Special characters are printed between <>'s. A space at the beginning or the end will be printed as so that it does not get "lost". The program counts the number of line feeds encountered in a text section. If any are seen, it will print the number of lines added. This number includes any 's that may be visible in the text line. A form feed causes the present page to be ejected. However, the cursor is not automatically moved over to the left margin on the next page. Thus, a "current column" is maintained and printed when a form feed is encountered. This column is affected by left and right margin settings, tabs, returns, and standard characters. However, pcl2english isn't smart about proportional fonts and some of the cursor positioning commands. Thus, the current column value is really only a help, and not to be relied upon when doing fancy stuff. The "-x" hex option will print out a line of hex equivalents, as can be seen in the following example. Here, the second line repeats the first line, but in hex. The other lines are like in the example above. (s10h1T 1B 28 73 31 30 68 31 54 (s10h primary font characters per inch = 10 (s1T primary font typeface = Pica In many cases, you can interchange printer drivers. Often, you can use a LaserJet driver on a DeskJet, or a DeskJet driver on a LaserJet. However, there are differences between the various printers that could cause differences in the printout. For example, the DeskJet is restricted in its ability to move the page back up. Thus, a LaserJet command to move the cursor (paper) back could be ignored on a DeskJet. Pcl2english was designed to recognize commands for a wide variety of printers, rather than be specific to one particular printer. Thus, if you decode something with pcl2english, and it doesn't seem that your printer is responding properly to a particular escape sequence, check in your printer manual to see if that sequence is indeed supported. ERRORS Below are a couple examples of error messages that one could get. Basically, these escape sequences are undefined, though they could be used on a future printer. If you encounter one of these, check your printer manual. A A WARNING!!! Improper/unknown escape sequence. &d5D &d5D Underline control = ??? COMPILING NOTES Pcl2english was developed on an Amiga. However it does not take advantage of any Amiga specific features, and should be able to run on a variety of machines. You will need to make changes in the compile options in the makefile to match your compiler. The one feature that this program does take advantage of is prototypes that are defined in ANSI C. MISCELLANEOUS Included with this program are two files called "chart" and "pcl_good". "chart" is a reference sheet that lists escape sequences in alphabetical order. "pcl_good" is a test file of all escape sequences handled by pcl2english. This was one of the files used to test the program. You can test the program by running: pcl2english -e pcl_good I should mention that my employer is Hewlett-Packard. Though I have used a variety of HP printers, I do not design/build printers for HP. My main motivation for this program comes as an owner and user. AMIGA NOTES There are three "printer devices" on the Amiga: PRT:, PAR:, and SER:. The PRT: device will route output to the appropriate parallel or serial port (PAR: or SER:) based on your Preferences setting. The PRT: device also "cooks" its input by converting "generic" escape sequences to the proper escape sequences used by your printer. These conversions are handled in the printer driver that is selected in Preferences. (For example, the HP_DeskJet or HP_LaserJet printer drivers.) What pcl2english wants is the PCL data being sent to PAR: (or SER: if you connect your printer to the serial port.) A program called CMD is available for capturing exactly this data. It is in the Utilities drawer for the Workbench 1.3 release. It is also on Fred Fish Disk #95. You need to be sure that if Preferences wants to send printer output to the parallel port, that you specify "parallel" in CMD. Similarly if you use the serial port. You will want to decide where you want to create the new file. For short cases, you may want to use ram memory since it is fast. For example, you might want FILE=RAM:CMD_file. For longer outputs, or something you want to save, you may give a hard disk or floppy file name. After the file(s) has been created, you can run pcl2english on it to see the escape sequences. Running CMD a second time will turn off the re-direction, and allow you to send to the printer again. You can now send the file captured by CMD to the printer by saying: copy file PAR: (or SER:). The file is already "cooked", so you want to send it directly to PAR: rather than PRT:. To run pcl2english, you will need to open up a CLI or Shell window. Then type in the command as shown above. If pcl2english is not in one of your "path" directories, then you will also need to specify the path to it so the computer can find it. Pcl2english was developed on the Manx Aztec C 5.0c compiler using 32 bit ints. -------------------------- Allen Norskog 900 Whaler's Way Fort Collins, CO 80525 --------------------------