Docs PDFiumVCL

FormFieldInfoAt property

Esta entrada API preserva identificadores, assinaturas, blocos de código e termos PDF em sua forma original.
Component: TPdf  ·  Unit: PDFium
Form field record for the widget located at the given page coordinate.

Syntax

property FormFieldInfoAt[X, Y: Single]: TPdfFormFieldInfo; // read only

Description

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 TPdfFormFieldInfoFieldType = 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.

Remarks

Example

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;

See Also

HasFormFieldAt, FormFieldInfo, FormFieldAt, FormFieldCount