THotPDF.FindStructureElementForMCID Method
Resolves the StructElem dictionary that owns a given (page, MCID) marked-content sequence by reading the page /StructParents key and indexing into the document ParentTree in constant time
Declaration
function FindStructureElementForMCID(PageIndex, MCID: Integer): THPDFDictionaryObject;
Unit
HPDFDoc
Parameters and result
| Value | Purpose |
|---|---|
PageIndex | Zero-based page index whose marked content is being resolved |
MCID | Marked-content identifier emitted on the page and wired into the ParentTree by AddStructureElement |
| Result | The owning indirect StructElem dictionary, or nil when the page is not tagged, the slot is empty, or either argument is out of range |
Behavior
- Reads the page
/StructParentsinteger, then returnsFParentTree[key][MCID]directly, so the lookup is independent of the number of structure elements - Indirect StructElem references are stored wrapped in a link inside the ParentTree; the method resolves the link to the target dictionary before returning
- The method never raises: an untagged page, an unallocated MCID, a
/nullplaceholder slot, or out-of-range arguments all collapse tonil - The returned element is the same indirect dict produced by
AddStructureElementand is suitable as the/SDtarget ofAddStructureDestinationLink