PDFium Delphi Component Docs

VisitStructureElements method

Component: TPdf  ·  Unit: PDFium
Streams the structure tree of one page through a visitor callback

Syntax

function VisitStructureElements(PageNumber: Integer; const Options: TPdfStructureReadOptions; Visitor: TPdfStructureElementVisitor; out Status: TPdfStructureReadStatus): Integer;

Description

VisitStructureElements walks the structure tree of PageNumber (one-based) and calls Visitor for every element instead of building the full TPdfStructureElements array

The return value is the number of visited elements; Status reports bounded or failed reads in the same way ReadStructureElements does

Remarks

    • Streaming keeps memory flat for deep hierarchies that would overflow a materialised snapshot
    • The visitor receives owned copies of element facts, so that no native handles escape the walk

Example

Count := Pdf1.VisitStructureElements(1, Options, procedure(const E: TPdfStructureElement)
begin
  Log(E.TypeName);
end, Status);

See Also