Previous Next


                                                106
      CHAPTER 3                                                                       Syntax



3.4.7 Cross-Reference Streams

      Beginning with PDF 1.5, cross-reference information may be stored in a cross-
      reference stream instead of in a cross-reference table. Cross-reference streams
      provide the following advantages:
      • A more compact representation of cross-reference information
      • The ability to access compressed objects that are stored in object streams (see
        Section 3.4.6, “Object Streams”) and to allow new cross-reference entry types
        to be added in the future

      Cross-reference streams are stream objects (see Section 3.2.7, “Stream Objects”),
      and contain a dictionary and a data stream. Each cross-reference stream contains
      the information equivalent to the cross-reference table (see Section 3.4.3, “Cross-
      Reference Table”) and trailer (see Section 3.4.4, “File Trailer”) for one cross-
      reference section. The trailer dictionary entries are stored in the stream
      dictionary, and the cross-reference table entries are stored as the stream data, as
      shown in the following example:

      Example 3.10

        ... objects ...

        12 0 obj               % Cross-reference stream
            << /Type /XRef     % Cross-reference stream dictionary
                /Size ...
                /Root ...
            >>
        stream
            ...                % Stream data containing cross-reference information
        endstream
        endobj

        ... more objects ...

        startxref
        byte_offset_of_cross-reference_stream % Points to object 12
        %%EOF

      Note that the value following the startxref keyword is now the offset of the cross-
      reference stream rather than the xref keyword. (See implementation note 21 in
      Appendix H.) For files that use cross-reference streams entirely (that is, PDF 1.5

Previous Next