PDFium Delphi Component Docs

OnFormSelectionRect event

Component: TPdf  ·  Unit: PDFium
Fires for each selection rectangle the form layer reports

Syntax

property OnFormSelectionRect: TPdfFormSelectionRectEvent read FOnFormSelectionRect write FOnFormSelectionRect;

Description

OnFormSelectionRect fires once for each distinct selection rectangle the form layer reports for the focused field. The handler receives a TPdfFormSelectionRect with a one-based PageNumber and page-space Bounds

Consecutive duplicates are suppressed; every reported rectangle is also appended to the list exposed by FormSelectionRects

Remarks

    • Handler signature: procedure(Sender: TObject; const SelectionRect: TPdfFormSelectionRect) of object
    • Use the live event for immediate overlay drawing, and FormSelectionRects for batch redraws
    • Call ClearFormSelectionRects when focus moves to another field

Example

procedure TMain.Pdf1FormSelectionRect(Sender: TObject; const SelectionRect: TPdfFormSelectionRect);
begin
  HighlightSelection(SelectionRect.PageNumber, SelectionRect.Bounds);
end;

See Also