function SpokenToPageChar(const Spoken: TPdfSpokenText; SpokenOffset: Integer; out Page, CharIndex: Integer): Boolean;
| Spoken | TPdfSpokenText - Spoken text and span mapping |
| SpokenOffset | Integer - Zero-based character offset in Spoken.Text |
| Page | Integer - Receives the one-based source page number |
| CharIndex | Integer - Receives the zero-based FTextPage character index |
True when the offset maps to a source range, otherwise FalseThe function scans the span table and returns the page and source character index owned by the first span that covers the spoken offset
Offsets that land on an unmapped separator before a mapped run clamp to that run's first source character; spoken runs longer than the source range clamp to the last source character
Reader fragments and reading units carry TableContext for tagged TH/TD cells and their paragraph descendants, including page-local table/cell identities, zero-based row/column slots, RowSpan and ColumnSpan
Explicit Headers IDs take precedence; otherwise Column/Row/Both scope and preceding overlapping grid positions determine header associations, with positional inference when Scope is absent
Header labels come from retained readable fragments, so filtered Artifact headers cannot leak into spoken metadata; nested paragraph cells inherit the owning cell's context
HeadersExplicit distinguishes declared ID associations from inferred scopes; HeadersComplete and ErrorMessage report missing, duplicate, cyclic, filtered or over-budget headers and unsupported grids
Tagged identities are structure-element indexes in the current page snapshot; geometric identities are indexes in the supplied TPdfTables/Cells arrays and Source distinguishes those domains
BuildSpokenReadingUnit optionally prefixes data text with associated header labels; synthetic announcements have ContextOnly=True spans and SpokenToPageChar returns False inside them, while body offsets map to exact native characters
The speech builder validates source text and current tagged header contexts, preserves selection/page state and leaves its var output unchanged on rejection; IncludeContext=False permits validated body-only speech when semantic context is incomplete
Cached fragments, returned fragments, reading units and source snapshots own separate header arrays; mutating one does not alter the others
Tagged enrichment permits 16384 elements, 4096 cells, 1024 columns, row indexes/spans below or up to 4096, depth-64 header references, 128 headers per cell, 1048576 UTF-16 units each for labels/expanded associations and 8388608 work visits
Unsupported metadata leaves source text intact with diagnostics; native speech mapping uses the existing exact top-level object/MCID profile and its character/object/work limits
if SpokenToPageChar(Spoken, SpokenOffset, PageNumber, CharIndex) then
PdfView1.TrackReadingWordAt(PageNumber, CharIndex);