lopdf
lopdf copied to clipboard
Support Name Tree and Number Tree
A name tree, according to the PDF 32000-1:2008 specification (7.9.6 Name Trees), is like a dictionary but it may be arbitrarily large, the keys are strings (not name objects) and are ordered, and there are various criteria on the values.
e.g. (from the spec
<</Limits [(Xenon) (Zirconium)]
/Names [(Xenon) 129 0 R
(Ytterbium) 130 0 R
(Yttrium) 131 0 R
(Zinc) 132 0 R
(Zirconium) 133 0 R
]
>>
A number tree, according to the PDF 32000-1:2008 specification (7.9.7 Number Trees), is 'similar to a name tree' except the keys are integers, sorted in ascending numerical order. };
/Nums [ 0 << \S \r >>
4 << \S \D >>
7 << \S \D
\P (A-)
\St 8
>>
]
They'll probably need an extension to the Object enum.
Should the library support this?
edit: whoops, accidentally submitted the issue part way through writing it.
In a way, name trees and number trees are supported, because they build upon the basic objects (mostly dictionaries) which are represented in the Object enum.
I admit, using them isn't very ergonomic at the moment and could be improved.
In terms of implementing this, it would not fit into the Object enum. This enum is meant to only represent actual objects (booleans, numbers, strings, dictionaries, etc.), which are defined in PDF1.7, section 7.3.
Opposed to this, Number Trees and Name Trees are what the spec calls "Common Data Structures" (defined in section 7.9).