PDFium Delphi Component Docs

SelectAllFormText method

Component: TPdfView  ·  Unit: PDFium
Selects every character in the focused AcroForm widget on the view's active page, the equivalent of pressing Ctrl+A within that widget.

Syntax

function SelectAllFormText: Boolean;

Description

SelectAllFormText wraps PDFium's FORM_SelectAllText entry point. The PDFium API was already bound at the unit level but had no high-level accessor until v1.23.0; this method gives applications the Ctrl+A-inside-a- widget gesture without subclassing the view.

Returns True when a selection is made, meaning the focused widget has at least one character, and False otherwise. It also returns False safely when the view is inactive, the document has no AcroForm, or no widget is focused.

The usual companion to GetSelectedFormText is a Copy All command: SelectAllFormText highlights every character in the focused widget, then GetSelectedFormText returns those characters as a WString ready for the clipboard.

Remarks

Example

procedure TForm1.miSelectAllClick(Sender: TObject);
begin
  if PdfView1.SelectAllFormText then
    sbInfo.SimpleText := 'Form text selected'
  else
    sbInfo.SimpleText := 'No focused form widget';
end;

// Copy-all pattern
procedure TForm1.miCopyAllClick(Sender: TObject);
begin
  if PdfView1.SelectAllFormText then
    Clipboard.AsText := string(PdfView1.GetSelectedFormText);
end;

See Also

GetSelectedFormText, FormUndo, FormField