Previous Next


                                         61
SECTION 3.2                                                                   Objects



return alone. The sequence of bytes that make up a stream lie between the stream
and endstream keywords; the stream dictionary specifies the exact number of
bytes. It is recommended that there be an end-of-line marker after the data and
before endstream; this marker is not included in the stream length.

Alternatively, beginning with PDF 1.2, the bytes may be contained in an external
file, in which case the stream dictionary specifies the file, and any bytes between
stream and endstream are ignored. (See implementation note 6 in Appendix H.)

Note: Without the restriction against following the keyword stream by a carriage re-
turn alone, it would be impossible to differentiate a stream that uses carriage return
as its end-of-line marker and has a line feed as its first byte of data from one that
uses a carriage return–line feed sequence to denote end-of-line.

Table 3.4 lists the entries common to all stream dictionaries; certain types of
streams may have additional dictionary entries, as indicated where those streams
are described. The optional entries regarding filters for the stream indicate
whether and how the data in the stream must be transformed (decoded) before it
is used. Filters are described further in Section 3.3, “Filters.”


Stream Extent

Every stream dictionary has a Length entry that indicates how many bytes of the
PDF file are used for the stream’s data. (If the stream has a filter, Length is the
number of bytes of encoded data.) In addition, most filters are defined so that the
data is self-limiting; that is, they use an encoding scheme in which an explicit
end-of-data (EOD) marker delimits the extent of the data. Finally, streams are
used to represent many objects from whose attributes a length can be inferred. All
of these constraints must be consistent.

For example, an image with 10 rows and 20 columns, using a single color
component and 8 bits per component, requires exactly 200 bytes of image data. If
the stream uses a filter, there must be enough bytes of encoded data in the PDF
file to produce those 200 bytes. An error occurs if Length is too small, if an
explicit EOD marker occurs too soon, or if the decoded data does not contain 200
bytes.

It is also an error if the stream contains too much data, with the exception that
there may be an extra end-of-line marker in the PDF file before the keyword
endstream.

Previous Next