property FormFieldInfoAt[X, Y: Single]: TPdfFormFieldInfo; // read only
FormFieldInfoAt performs a hit-test on the currently active page and returns the
TPdfFormFieldInfo record describing the widget annotation at
(X, Y). Coordinates are in PDF user space, with the origin at the
bottom-left corner of the page and units expressed in points (1/72 inch). The record
mirrors what FormFieldInfo[Index] returns — field type
(fiTextField, fiCheckBox, …), field name, alternate
name, flags, option labels, checked state, export value, and font size.
When the coordinate does not land inside any widget rectangle, FormFieldInfoAt
returns a default-initialised TPdfFormFieldInfo —
FieldType = fiUnknown and empty strings throughout. Use
HasFormFieldAt[X, Y] for a cheap yes/no probe before retrieving the full
record, or simply check the returned FieldType.
The lookup is O(n) over the page’s widgets and additionally decodes
Unicode field metadata, so it is heavier than HasFormFieldAt. In a
mouse-move handler check HasFormFieldAt first; only call
FormFieldInfoAt on click or hover-enter. Coordinates from a mouse position go through
TPdfView.PointToPage first to translate device pixels into page units.
/Annots wins).FieldType = fiSignature — combine with
SignatureCount to enumerate signing state separately.FormFieldAt invalidates cached records;
re-read after each write.
procedure TForm1.PdfView1Click(Sender: TObject);
var Info: TPdfFormFieldInfo;
PageX, PageY: Double;
begin
PdfView1.PointToPage(Mouse.CursorPos.X, Mouse.CursorPos.Y, PageX, PageY);
Info := Pdf1.FormFieldInfoAt[PageX, PageY];
if Info.FieldType <> fiUnknown then
ShowMessage(Info.Name);
end;