Control Codes
Page 120 100-88002 Rev B
Graphics Compression
Although the printer compression algorithms are documented, it is recommended that
our Windows printer driver be used to generate a graphic image. Our Windows’
printer driver selects the best compression method to use on a scan line by scan line
basis. The print driver can be directed to print to file, creating a .prn file. When
creating a .prn file, it is recommended that the Start/End Doc settings be cleared in
the Start/End Doc tab of the printer properties page. After the .prn file is created, it
can be read and sent to the printer by the host application.
Bit wise RLE. In bit wise RLE compression, the Most Significant Bit (MSB)
compression of each data byte denotes if the compressed data represents one or
zero bits. Bits zero through six indicate how many bits are represented as a one or
zero. A 34 Hex (34H) represents 34H bits set to zero. A 97H represents 17H bits set
to one.
[ESC] h <1> <5> <1> <34H> <97H> <8fH> <09H>
Byte wise RLE. In byte wise RLE compression, data is represented in byte
Compression pairs. The first byte is a count, and the second is the graphics data.
The graphics data byte is repeated the number of times represented by the count
byte.
[ESC] h <1> <5> <8> <09H> <ffH> <02H> <55H>
Where <09H> <ffH> means repeat ffH nine times and <02H> <55H> means repeat
55H two times.
Difference Compression. In difference compression, data is represented in byte pairs.
In compression, the first byte is an index into the byte stream, as it would exist if sent
in an uncompressed format, while the second byte is the data that is different in the
new scan line data; in other words, “The scan line is the same as the previous except
for the byte at a specific position.”
[ESC] h <1> <5> <254> <03H> <d5H> <0bH> <51H>
Where <03H> <d5H> means use the previously transmitted scan line data but change
byte 3 to a d5H and change byte 11 (0bH) to a 51H.
Same-as-previous Compression. In same-as-previous compression, the command
does not contain any graphics data. The command specifies that the printer is to use
the previous scan line data for the current scan line.
[ESC] h <1> <1> <255>.