TPDFTextRun

Content stream editing

Description

TPDFTextRun (unit Lib\PDFlibContentModel.pas, added in v3.109.0) is one text-showing instruction (Tj, TJ, ' or ") together with the font resource and size that were active when it executes; GetTextRuns returns one run per instruction in a TPDFTextRunArray

Syntax

Delphi

TPDFTextRun = Record
  InstructionIndex: Integer;
  FontResource: AnsiString;
  FontSize: Double;
  Text: AnsiString;
  OriginX, OriginY: Double;
  Tm11, Tm12, Tm21, Tm22, TmDX, TmDY: Double;
End;

Key members

InstructionIndexZero-based position of the instruction in the parsed program
FontResourceResource name set by the innermost Tf, without the leading slash; the walk tracks Tf through q/Q save and restore
FontSizeEffective size at the instruction
TextRaw string bytes of the instruction in the font's own encoding (ASCII for the standard simple fonts); TJ arrays concatenate their string elements
OriginX, OriginYOrigin of the first glyph in text space, captured by replaying the text-positioning operators (BT, Td, TD, Tm, T*); consumers needing device-space coordinates apply the page CTM themselves
Tm11..TmDYFull text matrix components so callers can reconstruct rotation and skew

See also

GetTextRuns, TPDFContentProgram, ReplaceTextRun, FindInstructionsInRect