CHAPTER 3
60
Syntax
a name. For example, in a font dictionary, the value of the
Type
entry is always
Font
, whereas that of the
Subtype
entry may be
Type1
,
TrueType
, or one of
several other values.
The value of the
Type
entry can almost always be inferred from context. The
operand of the
Tf
operator, for example, must be a font object; therefore, the
Type
entry in a font dictionary serves primarily as documentation and as information
for error checking. The
Type
entry is not required unless so stated in its
description; however, if the entry is present, it must have the correct value. In
addition, the value of the
Type
entry in any dictionary, even in private data, must
be either a name defined in this book or a registered name; see Appendix E for
details.
3.2.7 Stream Objects
A
stream object,
like a string object, is a sequence of bytes. However, a PDF
application can read a stream incrementally, while a string must be read in its
entirety. Furthermore, a stream can be of unlimited length, whereas a string is
subject to an implementation limit. For this reason, objects with potentially large
amounts of data, such as images and page descriptions, are represented as
streams.
Note:
As with strings, this section describes only the syntax for writing a stream as a
sequence of bytes. What those bytes represent is determined by the context in which
the stream is referenced.
A stream consists of a dictionary followed by zero or more bytes bracketed
between the keywords
stream
and
endstream
:
dictionary
stream
…
Zero or more bytes
…
endstream
All streams must be indirect objects (see Section 3.2.9, “Indirect Objects”) and
the stream dictionary must be a direct object. The keyword
stream
that follows
the stream dictionary should be followed by an end-of-line marker consisting of
either a carriage return and a line feed or just a line feed, and not by a carriage