THotPDF.GetLoadedNameTree Method
Fetches a name-tree category dictionary held in the loaded document's catalog /Names dictionary, creating it on first use if you ask it to
Declaration
function GetLoadedNameTree(const Category: AnsiString;
CreateMissing: boolean): THPDFDictionaryObject;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
Category | The category key of the name tree within the catalog /Names dictionary — Dests, JavaScript or EmbeddedFiles, for instance |
CreateMissing | Pass True and either dictionary that is missing — the /Names dictionary or the category dictionary — is created as a new indirect object; pass False and you get nil back instead |
Return value
The category dictionary once resolved; nil comes back where it is missing and CreateMissing is False, or where the document carries no loaded catalog
Usage notes
- Should /Names hold a non-dictionary entry, creation overwrites it rather than giving up, and both the catalog and the /Names dictionary are marked dirty so the change lands in the next save or incremental update
- What comes back is a name-tree root node; work through it with
InsertLoadedNameTreeEntryandRemoveLoadedNameTreeEntryso that key ordering remains valid - To find out which categories exist without creating anything, enumerate them with
GetLoadedNameTreeRootCount