function GetStructuredText(
const Options: TPdfStructuredTextOptions): TPdfStructuredTextPage;
GetStructuredText reads Unicode scalars, character boxes, font size, font weight, font name, angle and text-object identity through PDFium's native text APIs
Characters become styled spans, spans become physical lines, horizontally related lines become blocks, and block text is joined into the page-level Text field
Every native scalar is preserved as UTF-16, including supplementary-plane characters represented by surrogate pairs
ReadingOrder — roPhysicalLayout groups top-to-bottom and left-to-right geometry; roContentOrder preserves the native content-stream sequenceIncludeFontInfo — includes font name, size, weight and angle in each span, default TrueIncludeSemantics — maps the existing Tagged PDF or heuristic readable-content model to each block, default TrueMaxCharacters — fail-closed page character budget, default 1000000| Record | Key data |
|---|---|
TPdfStructuredTextPage | PageNumber, Width and Height, character and failure counts, Source, combined Text, and Blocks |
TPdfStructuredTextBlock | Bounds, text, structure kind, heading level, language, source, structure-element index, and Lines, the array of TPdfStructuredTextLine records clustered into the block; block Text joins those lines and block Bounds is the union of their bounds |
TPdfStructuredTextLine | Bounds, combined text, and styled spans |
TPdfStructuredTextSpan | Text, Bounds, the SourceStartIndex and SourceCharacterCount range, FontName, FontSize, FontWeight, and Angle |
Kind, HeadingLevel, Language, Source and StructElementIndexTPdfContentFragment of the readable-content model behind IncludeSemantics is matched to a block by BoundingRect overlap and also carries LineRects, one PDF page-space rectangle per fragment text line whose union is that BoundingRectUnmappedCharacterCount counts native zero mappings replaced by U+FFFDGeometryFailureCount counts non-break characters without usable native bounds whilst retaining their textPhysical ordering uses O(n log n) character sorting, geometrically growing line and span buffers, buffered UTF-16 construction, and adjacent non-null text-object font caching
Set IncludeFontInfo or IncludeSemantics to False when those enrichment layers are unnecessary
var
Options: TPdfStructuredTextOptions;
Page: TPdfStructuredTextPage;
begin
Options := TPdfStructuredTextOptions.Default;
Options.MaxCharacters := 250000;
Page := Pdf1.GetStructuredText(Options);
Memo1.Text := Page.Text;
end;