PDFiumPas Docs

TPdfView.BuildSpokenReadableText

Unit: PDFium
function BuildSpokenReadableText(const Fragments: TPdfContentFragments;
  var Spoken: TPdfSpokenText; DocumentOrder: Boolean = False): Boolean;

Available in every edition since v3.284.0, updated 2026-11-02

Composes explicitly supplied fragments using TryComposeReadableText after certifying that they still form one exact, unambiguous contiguous slice of the current readable stream. The default matches a single page snapshot; DocumentOrder=True matches DocumentReadableContent, including its certified logical order, content-order fallback or optional paragraph continuation

Fragments := Pdf.DocumentReadableContent;
if PdfView.BuildSpokenReadableText(Fragments, Spoken, True) then
  WriteLn(Spoken.Text);

Enable the semantic/Form inclusion options required by the supplied sources, including IncludeUnownedSemanticContent for sources without certified MCR ownership. A complete current reader snapshot is required; malformed or unsupported source inventories reject

Enable IncludeEmptySemanticSources before collecting sources when empty or whitespace-only declarations must participate in composition. Empty ActualText without alternative text is still a character substitution, while empty Alt/E retains its word boundary

Every glyph span retains its exact native page and character position, including joined source parts. ActualText, Alt and E spans remain ContextOnly with no invented glyph map. Inserted word-boundary spaces are also ContextOnly; original glyph whitespace keeps its actual mapping. SpokenToPageChar distinguishes these domains by UTF-16 offset

Source text, language, order category, logical position, role, bounds, source parts and semantic source graphs are revalidated. Reordered sources, skipped middle fragments, ambiguous duplicate matches, forged metadata, revoked options and foreign-page edits reject. A valid contiguous subrange is accepted

Empty primaries still participate in current-source validation. rssAlternatives groups reject automatic composition because they require an explicit declaration choice. Semantic speech retains all original alternatives in the input snapshots without fabricating a common parent

Success and failure preserve the viewer page and selection; failure leaves the caller's Spoken unchanged. This method returns composed raw body text without table/list announcements or automatic voice changes, and does not replace BuildSpokenReadingUnit or mutate saved content

Composition accepts at most 4096 input fragments and 262144 output UTF-16 units. Current-stream matching accepts at most 16384 canonical fragments and 4194304 candidate comparisons; document composition is bounded to 64 pages. Existing reader, source graph and native mapping limits also apply. These bounds do not provide process-wide native resource isolation

The focused Delphi/FPC Win64 evidence covers nineteen positive native profiles and one explicit-choice rejection profile, with 57 independently inspected saved outputs and 171 pages per compiler. It covers exact whitespace, supplementary characters, nested/empty declarations, nontext sources, shared calls, reverse structure order, cross-page composition, empty/space-only structure and native primaries and paragraph-source mappings

Repeated overlapping glyphs can disappear from native character enumeration while their real page objects and structure ActualText owners remain valid. Such objects retain semantic provenance without acquiring invented character mappings

Saved generations preserve original semantic streams; existing source-stream rewrite preservation, unprovable native paint correspondence, Form-level ActualText and instance-safe editing remain separate work