Previous Next


                                                     162
         CHAPTER 3                                                                              Syntax



         • The values associated with the keys may be objects of any type. Stream objects
           are required to be specified by indirect object references. It is recommended,
           though not required, that dictionary, array, and string objects be specified by
           indirect object references, and other PDF objects (nulls, numbers, booleans,
           and names) be specified as direct objects.
         • The data structure can represent an arbitrarily large collection of key-value
           pairs, which can be looked up efficiently without requiring the entire data
           structure to be read from the PDF file. (In contrast, a dictionary is subject to an
           implementation limit on the number of entries it can contain.)

         A name tree is constructed of nodes, each of which is a dictionary object.
         Table 3.33 shows the entries in a node dictionary. The nodes are of three kinds,
         depending on the specific entries they contain. The tree always has exactly one
         root node, which contains a single entry: either Kids or Names but not both. If the
         root node has a Names entry, it is the only node in the tree. If it has a Kids entry,
         each of the remaining nodes is either an intermediate node, containing a Limits
         entry and a Kids entry, or a leaf node, containing a Limits entry and a Names
         entry.

                           TABLE 3.33 Entries in a name tree node dictionary
KEY       TYPE       VALUE

Kids      array      (Root and intermediate nodes only; required in intermediate nodes; present in the root
                     node if and only if Names is not present) An array of indirect references to the immediate
                     children of this node. The children may be intermediate or leaf nodes.

Names     array      (Root and leaf nodes only; required in leaf nodes; present in the root node if and only if Kids
                     is not present) An array of the form
                        [ key1 value1 key2 value2 … keyn valuen ]

                     where each keyi is a string and the corresponding valuei is the object associated with that
                     key. The keys are sorted in lexical order, as described below.

Limits    array      (Intermediate and leaf nodes only; required) An array of two strings, specifying the (lexi-
                     cally) least and greatest keys included in the Names array of a leaf node or in the Names
                     arrays of any leaf nodes that are descendants of an intermediate node.

         The Kids entries in the root and intermediate nodes define the tree’s structure by
         identifying the immediate children of each node. The Names entries in the leaf
         (or root) nodes contain the tree’s keys and their associated values, arranged in
         key-value pairs and sorted lexically in ascending order by key. Shorter keys

Previous Next