PCL 6 is documented in the PCL XLTechnical Reference Manual
(HP)
which has been available from HP at
http://www.hpdevelopersolutions.com/downloads/64/358/xl_ref20r22.pdf
and http://www.undocprint.org/_media/formats/page_description_languages/pcl_xl_2_0_technical_reference_rev2_2.pdf
This manual may confuse as much as it explains. For example, the sample on page 26 is very general and is not at all complete. It is missing the @PJL ENTER LANGUAGE="PCLXL" command and the Stream Header (Section 7, page 201) which for ASCII would be
' HP PCL-XL;2;0
or for an older printer you might use
' HP PCL-XL;1;1
The first character of that line specifies "Binding Format" which can be: "'" ASCII, ")" Binary (little endian) or "(" Binary (big endian). The single quote tells the printer that you want to send ASCII commands rather than Binary.
But not all printers will support ASCII (do any?) because it means they have to be able to parse and compile the command names rather than just interpret the single byte binary tokens. In other words, the printer has to be the compiler as well as the byte code interpreter. My 2300L, 4000, 4050, and 5500 will not accept that binding and I get a "Unsupported Binding" error.
Even in ASCII, you can't use all the names you are trying to use: Check page 24 at the bottom of the page... "The attribute identifiers in Figure 2-1 are represented by a name. The actual attribute identifier is a unique number from a set of attribute identifiers defined for the protocol."
Also, page 27 notes that the values that start with an e are integers as listed in Appendix G
If you want to do the ASCII binding, you really have to use the JetASM program to translate your labels to binary code. This program is only available to developers (as far as I know).
So you have to do binary. You need a binary editor and you will have to put out the binary sequences that would be produced by a PCL6 printer driver. There are - Values (Appendix G) - Attributes (Appendix E. Note: Appendix F has some typos) - Commands (Appendix C)
Note that all values and attributes are preceded by a "tag value" that indicates the type of value or attribute that follows. (Appendix D) e.g. a single byte value must be proceeded by a 0xC0 so to specify that you wish error reports to be printed, you must send 0xC0 0x02 0xF8 143 as part of the setup for the BeginSession command. The C0 says "this next byte is an unsigned value" then the 2 is accepted as that value. The F8 says "this next byte is an attribute ID" and the 143 (0x8F) is accepted as the attribute ErrorReport. This all has the effect of setting up an attribute - value pairing for the upcoming BeginSession command. Note that the BeginSession command has 3 required attribute - value pairs.
Since commands do not need a "tag value" you could say that the "tag values" for Values and Attributes are really commands that specify the loading of a value or attribute, but the difference is that commands must happen AFTER the attribute - value pairs are setup for that command and the "tag values" for Values or Attributes must come BEFORE the values or attributes they specify.
Your best bet for a working example file is to setup a PCL6 driver to print to file and then print a test page or something like that.
Questions:
Just trying to understand how PCL 6 works.. how would you go about showing "hello world"? Would it be different doing it through JetASM instead of binary?
Comments:
That's correct. Infact, PCL6 is totally different in a manner that it works on binary streams rather than esc sequences. For ex., for a form feed which you are asking, it has a "BeginPage" and similarly an "EndPage" operator. You will have to decode this in the binary stream. For more info on how to decode it, please refer HP PCL 6 documentation. I have done a similar kind of conversion in the past but for a limited functionality.
Thanks,
Nitin