Portfolio Folder Building and Collection State

The ID-based builders create the catalog /Collection with its /Folders tree — recursive /Type /Folder dictionaries linked through first-child /Child and next-sibling /Next — while the state writers configure the navigator split and colors, and the readers bring the whole collection state back

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 under a previously returned ID, rejecting duplicate sibling names per ISO 32000-2 Table 158 and refreshing the root free-ID range

THotPDF.AddDocumentAttachmentToCollectionFolder(FolderID, FileName, Description) streams the disk file into an embedded-file stream and filespec and inserts it into the embedded-files name tree keyed by the folder ID, making 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 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, and THotPDF.SetPortfolioItemDirectMetadata(FileName, Key, Value) stores a plain string value; both require the key to be 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 color 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 distinguish string, numeric and subitem entries with prefixes, and 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 returned by the schema queries

PDF Portfolios and Collections covers the schema and view surface, including the older path-addressed AddPortfolioFolder API