function GetSelectedFormText: WString;
GetSelectedFormText is a high-level entry point on top of PDFium's
FORM_GetSelectedText binding. The PDFium API was already
bound at the unit level but had no Pascal-friendly accessor until
v1.23.0; this method wraps it tidily
The method targets whatever AcroForm widget currently owns the focus on the view's active page (the same widget that responds to keyboard input). When the user has selected a range of characters inside that widget — for example by Shift+Arrow or click-and- drag — GetSelectedFormText returns the selection text as a WString. When no text is selected (just a caret position), GetSelectedFormText returns an empty string
The method is a no-op when:
Active = False);FormType = ftNone);In each of these cases the return value is an empty string — the method never raises
FormField[i] := ... may collapse the selection back to a caret
procedure TForm1.btnCopyClick(Sender: TObject);
begin
if not PdfView1.CopySelectedFormTextToClipboard then
ShowMessage('No form text selected');
end;