Swallowing PCL Commands

Monday Jan 30, 2012


It was a bunch of  years ago I had two clients with problem resolved by the same solution.  The first issue was the printing of a blank page at the start of the start of each print job a blank page would print, the other was the strange output behaviour because the host system was filling the initialization string with NUL characters.  The first should have been simple; however, the printer didn't support a suppress blank pages" (or similar) option.

After scratching my head for a few days I decided to do something unconventional.  The solution came from tricking the printer into "swallowing" the FF.  In the first instance this command appeared as the first character in the output, so we modify the initialization string (or similar) string and make the last command the creation of a fake font character code.  This character has only one byte of data (the FF).  This will load the FF into memory as the font we define and as such never get processed.

This trick was also useful for the host system (VMS) as it wanted to fill up the end of an initialization string with NULL characters to based on the internal block size.  Here we did the same but simply calculated the value based on the number of characters left in the block.

The command looks like this:

<ESC>*c127E<ESC>(s1W

In this example we assume that the next character in the output is the FF.

In this instance we are overwriting character 127, in a downloaded font that we’ve never identified.  As such it should not impact anything.  The next sequence tells the printer that the next 1 byte of data (following the W) is part of this font.  If you needed to ‘swallow’ more data then we simply change this value to the number of bytes to consume.

Next, if the host system wasn't going allow me to add commands at the start of the print job I would leverage Windows separator pages and insert them that way (see: inserting-print-commands).