Previous Next


                                         102
CHAPTER 3                                                                       Syntax



The creator of a PDF file has flexibility in determining which objects, if any, to
store in object streams. For example, it can be useful to store objects having
common characteristics together, such as “fonts on page 1,” or “Comments for
draft #3.” These objects are known as a collection.

To avoid a degradation of performance, such as would occur when downloading
and decompressing a large object stream to access a single compressed object, the
number of objects in an individual object stream should be limited. (See
implementation note 19 in Appendix H.) This may require a group of object
streams to be linked as a collection, which can be done by means of the Extends
entry in the object stream dictionary.

Extends can also be used when a collection is being updated to include new
objects. Rather than redefine the original object stream, which would require
duplicating the stream data, the new objects can be stored in a new object stream.
This is particularly important when adding an update section to a document.

The stream data in an object stream consists of the following items:
• N pairs of integers, where the first integer in each pair represents the object
  number of a compressed object and the second integer represents the byte off-
  set of that object, relative to the first one. The offsets must be in increasing or-
  der, but there is no restriction on the order of object numbers.
  Note: The byte offset in the decoded stream of the first object is the value of the
  First entry.
• The  N objects stored consecutively. Only the object values are stored in the
  stream; the obj and endobj keywords are not used. A compressed dictionary or
  array may contain indirect references.
  Note: It is illegal for a compressed object to consist of only an indirect reference;
  for example, 3 0 R.
  By contrast, dictionaries and arrays in content streams (Section 3.7.1) may not
  contain indirect references. In an encrypted file, strings occurring anywhere in
  an object stream must not be separately encrypted, since the entire object
  stream is encrypted.
  Note: The data for the first object is not required to immediately follow the last
  byte offset. Future extensions may place additional information between those
  two points in the stream.

Previous Next