ReplaceTextRun
Content stream editing
Description
Replaces the shown text of one text-showing instruction in place, a true replacement in the content stream rather than a masked overlay
Syntax
Delphi
Function TPDFContentProgram.ReplaceTextRun(InstructionIndex: Integer; Const NewText: AnsiString): Boolean;Parameters
| InstructionIndex | Index of the text-showing instruction whose shown text is replaced |
|---|---|
| NewText | Replacement text, written as a literal string in the font's encoding |
Return values
True when the instruction was found and its text replaced, otherwise false
Remarks
The new bytes are written as a literal string in the font's encoding; positioning operators are untouched, so the glyphs render at the original anchor with the original font
Use GetTextRuns to enumerate text-showing instructions, or ReplaceTextStringRange to replace only part of one string operand
See also
TPDFContentProgram, GetTextRuns, ReplaceTextStringRange, WritePageContentLayer