Portfolio Folder Building and Collection State
The ID-based builders create the catalogue /Collection with its /Folders tree — recursive /Type /Folder dictionaries chained through the first-child /Child and next-sibling /Next entries — whilst the state writers configure the navigator split and colours, and the readers bring the whole collection state back again
Folder and attachment writers
THotPDF.EnsureCollectionRootFolder(RootName, Description) guarantees the root folder and returns its ID — 0 for a fresh tree — and THotPDF.AddCollectionChildFolder(ParentFolderID, FolderName, Description) appends a child beneath a previously returned ID, rejecting duplicate sibling names as ISO 32000-2 Table 158 requires and refreshing the root free-ID range
THotPDF.AddDocumentAttachmentToCollectionFolder(FolderID, FileName, Description) streams the file on disk into an embedded-file stream and filespec and inserts it into the embedded-files name tree keyed by the folder ID, which makes the payload addressable inside that folder
Navigator state writers
THotPDF.SetPortfolioSplit(Direction, Position) writes the /CollectionSplit dictionary with a horizontal, vertical or none direction and an optional position; THotPDF.SetPortfolioColor(Element, R, G, B) styles one of the five navigator elements, and THotPDF.SetPortfolioColors(Colors) applies every element of the THPDFCollectionColorsInfo whose Present flag is set
Item metadata writers
THotPDF.SetPortfolioItemNumericMetadata(FileName, Key, Value, Prefix, UseSubitemDictionary) writes a typed numeric column value, optionally as a /CollectionSubitem with a display prefix, whilst THotPDF.SetPortfolioItemDirectMetadata(FileName, Key, Value) stores a plain string value; both insist that the key was registered in the schema first
Readers
THotPDF.GetLoadedCollectionSortOrder returns the column sort keys with their ascending flags; THotPDF.GetLoadedCollectionSplit fills a THPDFCollectionSplitInfo record with its THPDFCollectionSplitDirection and optional position, and THotPDF.GetLoadedCollectionColors reads the colour scheme into a THPDFCollectionColorsInfo of five THPDFCollectionRGBColor elements
THotPDF.GetLoadedCollectionItemFields(FileName) enumerates every schema-column value stored on one item, emitting THPDFCollectionItemFieldValue records in a THPDFCollectionItemFieldValueArray that tell string, numeric and subitem entries apart by their prefixes, whilst THotPDF.GetLoadedCollectionFolderTree rebuilds the complete folder hierarchy as THPDFCollectionFolderNodeInfo records in a THPDFCollectionFolderNodeArray, with parent, child and sibling IDs, description and dates
The schema-array companion of the documented THPDFCollectionSchemaFieldInfo is the THPDFCollectionSchemaFieldInfoArray handed back by the schema queries
PDF Portfolios and Collections covers the schema and view surface, including the older path-addressed AddPortfolioFolder API