Previous Next


                                         64
CHAPTER 3                                                                      Syntax



The definition of an indirect object in a PDF file consists of its object number and
generation number, followed by the value of the object bracketed between the
keywords obj and endobj. For example, the definition

   12 0 obj
      ( Brillig )
   endobj

defines an indirect string object with an object number of 12, a generation
number of 0, and the value Brillig.

The object can be referred to from elsewhere in the file by an indirect reference
consisting of the object number, the generation number, and the keyword R:

   12 0 R

Beginning with PDF 1.5, indirect objects may reside in object streams (see
Section 3.4.6, “Object Streams”). They are referred to in the same way; however,
their definition does not include the keywords obj and endobj.

An indirect reference to an undefined object is not an error; it is simply treated as
a reference to the null object. For example, if a file contains the indirect reference
17 0 R but does not contain the corresponding definition

   17 0 obj
      …
   endobj

then the indirect reference is considered to refer to the null object.

Note: In the data structures that make up a PDF document, certain values are re-
quired to be specified as indirect object references. Except where this is explicitly
called out, any object (other than a stream) may be specified either directly or as an
indirect object reference; the semantics are entirely equivalent. Note in particular
that content streams, which define the visible contents of the document, may not
contain indirect references (see Section 3.7.1, “Content Streams”). Also, see imple-
mentation note 8 in Appendix H.

Example 3.1 shows the use of an indirect object to specify the length of a stream.
The value of the stream’s Length entry is an integer object that follows the stream

Previous Next