TPdfWordBox 範囲から TPdfSpokenText チャンクを作成しますfunction BuildSpokenTextFromWords(const Words: TPdfWordBoxes; FirstWord, LastWord: Integer): TPdfSpokenText;
| Words | TPdfWordBoxes - ページまたはビューアーからの単語ボックス |
| FirstWord | Integer - 最初のゼロベースの単語インデックス、0 にクランプ |
| LastWord | Integer - 最後のゼロベースの単語インデックス、High(Words) にクランプ |
Text が音声エンジン向けに準備済みで、Spans が各単語をページテキストへ対応付ける TPdfSpokenTextこのヘルパーは選択された TPdfWordBox 範囲を走査し、各単語を SpokenTextAppend で追加します
結果のスパンテーブルは各単語のページ番号、元の文字インデックス、元の文字数を保持するため、音声エンジンのオフセットを PDF ページへ逆変換できます
SpokenToPageChar または TPdfReadingSession.FeedSpokenPosition を使いますWords := Pdf1.PageWordBoxes;
Spoken := BuildSpokenTextFromWords(Words, 0, High(Words));