PDFiumPas Docs

TPdfView.BuildSpokenSemanticScope

Unit: PDFium
function BuildSpokenSemanticScope(
  const Fragment: TPdfContentFragment;
  ScopeIndex: Integer;
  SemanticSource: TPdfReadableSemanticSource;
  var Spoken: TPdfSpokenText): Boolean;

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

Use a current certified fragment from ReadablePageContent or DocumentReadableContent with IncludeSemanticReplacements enabled and an active bound view. ScopeIndex is zero-based in Fragment.SemanticScopes; select rssActualText, rssAlternateText or rssExpansion

The method verifies the complete current fragment, all source parts, scope values and presence flags, parent identities, languages, source-part references and metadata-only state. It then selects the requested declaration. A missing or whitespace-only value, invalid index/kind, revoked policy, edited source, stale identity or forged metadata returns False without modifying Spoken

On success, Spoken.Text contains the selected property value and one ContextOnly=True span covers it. SpokenToPageChar returns False: selecting a declaration does not provide a glyph correspondence. The method preserves the current page and selection. Use the selected scope's Language for voice selection

This allows applications to offer alternate descriptions and expansions alongside ActualText, and to expose nested declarations without repeating them in the default flat reading stream. SemanticMetadataOnly fragments can expose alternatives even when their primary ActualText is empty and BuildReadingUnits returns no unit

Default flat presentation selects the outermost complete structure owner and prefers its ActualText, then Alt, then E. This is the component's presentation policy, not a universal rule that PDF mandates for every nested or mixed-domain scope. All retained declarations remain available for explicit selection

Filtering any source in the complete owner or excluding a declared Artifact scope suppresses the entire fragment, including nested alternatives. Policy/language changes and edits on any source page invalidate previous snapshots. Cached results and reading units own independent scope arrays and nested source references

Since v3.279.0, the qualified profile includes object-backed native ActualText/Alt/E graphs within complete structure semantic owners, including nested, partial and multi-MCID coverage and inner mixed-domain overlap. Since v3.280.0, it also includes standalone native graphs without a structure replacement, with certified partial/multiple MCR ownership and independent uncovered glyphs. Origin distinguishes the declaration domains, and explicit selection preserves their values and complete coverage

Since v3.281.0, crossing native/structure declarations can form a complete connected component with SemanticSource=rssAlternatives and SemanticMetadataOnly=True. The group has no implicit primary or reading unit; select an individual scope and rssActualText, rssAlternateText or rssExpansion to speak its exact value after full component validation. rssAlternatives is a fragment classification, not a selectable property for this method

Since v3.282.0, this also validates certified nonpainting sequence sources. Their SemanticParts use Kind=spkEmptyMarkedContent with no native object path or painted geometry; speech remains ContextOnly and does not invent glyph positions. Sources without certified MCR ownership, unprovable paint inventories, existing source-stream rewrite preservation, character/word substitution composition and Form-level ActualText remain separate work; this API does not certify semantic correctness or general PDF/UA conformance

See TPdfContentFragment, IncludeSemanticReplacements and BuildSpokenReadingUnit