class PDF::NameTree
- PDF::NameTree
- Reference
- Object
Overview
A name tree serves a similar purpose to a dictionary—associating keys and values—but by different means. A name tree differs from a dictionary in the following important ways:
-
Unlike the keys in a dictionary, which are name objects, those in a name tree are strings.
-
The keys are ordered.
-
The values associated with the keys may be objects of any type, but they must always be specified via indirect object references.
-
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.22 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, then 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.
Included Modules
Defined in:
pdf/data/nametree.crConstructors
Instance Method Summary
-
#limits : Array(String) | Nil
Limits array (Intermediate and leaf nodes only; required) An array of two strings, specifying the (lexically) 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.
-
#render_to_pdf(io : IO) : IO
for mixing-in module
Renderable
Instance methods inherited from module PDF::Renderable
render_to_pdf(io : IO) : IO
render_to_pdf
Constructor Detail
Instance Method Detail
Limits array (Intermediate and leaf nodes only; required) An array of two strings, specifying the (lexically) 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.