Graphics Programs Reference
In-Depth Information
ET
endstream
endstream keyword
endobj
end of object
Here, the dictionary just contains the
/Length
entry, which gives the length of the stream
in bytes.
All streams must be indirect objects. Streams are almost always compressed, using a
variety of mechanisms, which are listed in
Table 3-3
.
Table 3-3. PDF stream compression methods
Method name
Description
/ASCIIHexDecode
Produces one byte of uncompressed data for each pair of hexadecimal digits
in the compressed data.
>
indicates end of data. Whitespace is ignored.
This filter and
/ASCII85Decode
are intended to reduce data to 7
bits—
/ASCII85Decode
is more complicated, but more compact.
/ASCII85Decode
This 7-bit encoding uses the printable characters
!
through
u
and
z
. The
sequence
~>
indicates end of data.
/LZWDecode
Implements Lempel-Ziv-Welch compression, as used by the TIFF image
format.
/FlateDecode
Flate compression, as used by the open source zlib library. Defined in RFC
1950. Both
/LZWDecode
and
/FlateDecode
can have
predictors
in the
stream dictionary, which define postprocessing on the data to reverse pre-
processing which was done when it was compressed.
/RunLengthDecode
A simple byte-based run-length compressor.
/CCITTFaxDecode
Implements Group 3 and Group 4 encoding, as used by fax machines. Works
well on monochrome (1bpp) images, not for general data.
/JBIG2Decode
A more modern, better compression mechanism for the kinds of data suitable
for use with
/CCITTFaxDecode
, but also suitable for grayscale and color
images and general data. Implements the JBIG2 compression method.
/DCTDecode
JPEG lossy compression. Whole JPEG files can be put in here, complete with
all the headers.
/JPXDecode
JPEG2000 lossy and lossless compression. Limited to the JPX baseline set of
features, with a few exceptions.
Here's an example of a compressed stream:
796 0 obj
<</Length 275 /Filter /FlateDecode>>
stream
HTKO0֟
And 268 more bytes...
endstream
endobj
Multiple filters can be used, by specifying an array instead of a name for the
/Filter
entry in the stream's dictionary. For example, an image compressed with the JPEG
method then ASCII85 encoded, might have the following filter entry: