PCL
2-84
Zlib
Zlib is a generic compression method. It refers to a standard for compression as well
as the library that implements the standard.
The zlib compression method uses the deflate algorithm. This same algorithm is used
by more widely known compression utilities such as PKZIP and GZIP.
Compressed data is a series of variably-sized blocks. An encoder determines how to
break the data into blocks and finds the best compression method to use for each
block.
An encoder works based on the following principles. The encoder creates a dictionary
containing different characters in a set of data. Short strings of bits represent more
commonly occurring characters, and long strings of bits represent less frequently
used characters. A probability tree determines which characters are frequently used.
Repeated patterns in a string of characters are identified and stored, so the string
does not have to be stored multiple times.
A three-bit zlib header is added to the beginning of a block to describe the type of
compression used and indicates whether the block is a final block. Other information
in the header includes checksums, compression algorithm used, and the level of
compression. In compression all checksums are set to zero, and in decompression the
checksums are ignored.
The memory required for zlib compression and decompression is independent of the
size of the data to be compressed or decompressed.
The number 999 does not conflict with other compression types, so it is used to
represent zlib compression. See page 2-69 for more information.
Group 3 and Group 4 Raster Compression
Since Group 4 images do not use line endings, the width of the image must be
specified using the Raster Width command (
ESC
*r#S).
The compressed image data is sent to the printer using the Transfer Raster Data
command (
ESC
*b#W
). The maximum number of bytes that can be sent using the
Transfer Raster Data command is 32K bytes. Images larger than 32K bytes must be
broken up and sent using multiple commands. It does not matter where the image is
broken, or how many Transfer Raster Data commands are used. Once the image is
started (with a Transfer Raster Data command), no other commands are allowed until
the entire image has been sent.