FindInstructionsInRect

Content stream editing

Description

Returns instruction-index ranges whose painted content intersects the axis-aligned rectangle from (Left, Top) to (Right, Bottom), expressed in default user space (bottom-left origin, points)

Syntax

Delphi

Function TPDFContentProgram.FindInstructionsInRect(Left, Top, Right, Bottom: Double; Out Ranges: Array Of TPDFInstructionRange; IncludeText: Boolean= True): Integer;

Parameters

LeftX coordinate of the left edge of the query rectangle
TopY coordinate of the top edge of the query rectangle
RightX coordinate of the right edge of the query rectangle
BottomY coordinate of the bottom edge of the query rectangle
RangesReceives the matching instruction-index ranges, in ascending First order
IncludeTextPass False to skip the estimated text-run pass, for callers that measure glyphs with the page fonts themselves; the default is IncludeText = True

Return values

The number of ranges returned in Ranges

Remarks

The scan covers text-showing instructions (Tj, TJ, ', "), path-construction and paint ranges (m..re..f/S), and XObject Do draws

CTM tracking is approximate: it honours cm, q and Q for the common identity-CTM baseline (no transform) and for linear scales, so rotated or sheared CTMs may under- or over-report

Ranges come back in ascending First order; the caller should delete them descending to keep indexes stable

See also

TPDFContentProgram, GetTextRuns, EnumImagePlacements, ReplaceTextRun, TPDFInstructionRange