StructTreeItemCount

Tagged PDF, Content Extraction

Description

Takes a flattened depth-first snapshot of the document's structure tree and returns the number of structure elements in it.

Syntax

Delphi

Function TPDFlib.StructTreeItemCount: Integer;

Return values

0The document is not tagged or has no structure elements.
NThe number of structure elements in the snapshot.

Remarks

Every call rebuilds the snapshot, so the item getters always describe the structure tree as it stood at the most recent count. Items are numbered 1 to N in depth-first document order: an element is directly followed by its children. Use GetStructTreeItemText and GetStructTreeItemIntProperty to inspect each item — the read-side counterpart of the BeginTag family for auditing tagged documents, exporting their structure or checking accessibility markup before repairs.

Example

Count:= PDF.StructTreeItemCount;
for I:= 1 to Count do
  Memo1.Lines.Add(StringOfChar(' ', 2* PDF.GetStructTreeItemIntProperty(I, 6))+
    PDF.GetStructTreeItemText(I, 1));

See also

GetStructTreeItemText, GetStructTreeItemIntProperty, IsTaggedPDF, GetPDFUADiagnostics