PDFium Delphi Component Docs

ReadStructureElements method

Component: TPdf  ·  Unit: PDFium
Reads an owned snapshot of the structure tree rooted at one page

Syntax

function ReadStructureElements(PageNumber: Integer; const Options: TPdfStructureReadOptions; out Status: TPdfStructureReadStatus): TPdfStructureElements;

Description

ReadStructureElements walks the tagged structure tree for PageNumber (one-based) and returns an owned TPdfStructureElements array with types, titles, MCIDs, kid indexes and reference facts

Status explains an empty result, separating an untagged document from a bounded or failed read

Remarks

    • Use IsTagged first to check whether the document carries a structure tree at all
    • Repeated reads are served from the structure cache; see StructureCacheCapacity and StructureElementsForPage
    • For very deep trees, prefer VisitStructureElements, which streams visits instead of materialising the whole array

Example

var St: TPdfStructureReadStatus;
Elements := Pdf1.ReadStructureElements(1, Default(TPdfStructureReadOptions), St);

See Also