Previous Next
65
SECTION 3.3 Filters
in the file. This allows applications that generate PDF in a single pass to defer
specifying the stream’s length until after its contents have been generated.
Example 3.1
7 0 obj
<< /Length 8 0 R >> % An indirect reference to object 8
stream
BT
/F1 12 Tf
72 712 Td
( A stream with an indirect length ) Tj
ET
endstream
endobj
8 0 obj
77 % The length of the preceding stream
endobj
3.3 Filters
Stream filters are introduced in Section 3.2.7, “Stream Objects.” A filter is an
optional part of the specification of a stream, indicating how the data in the
stream must be decoded before it is used. For example, if a stream has an
ASCIIHexDecode filter, an application reading the data in that stream will
transform the ASCII hexadecimal-encoded data in the stream into binary data.
An application program that produces a PDF file can encode certain information
(for example, data for sampled images) to compress it or to convert it to a port-
able ASCII representation. Then an application that reads (consumes) the PDF
file can invoke the corresponding decoding filter to convert the information back
to its original form.
The filter or filters for a stream are specified by the Filter entry in the stream’s
dictionary (or the FFilter entry if the stream is external). Filters can be cascaded
to form a pipeline that passes the stream through two or more decoding
transformations in sequence. For example, data encoded using LZW and ASCII
base-85 encoding (in that order) can be decoded using the following entry in the
stream dictionary:
/Filter [ /ASCII85Decode /LZWDecode ]
Previous Next