PDFium Component Docs

FormFieldAt property

Component: TPdf  ·  Unit: PDFium
Read or write the value of the form field located at the given page coordinate

Syntax

property FormFieldAt[X, Y: Single]: WString; // read / write

Description

FormFieldAt looks up the AcroForm widget annotation that contains the page-space point (X, Y) and exposes its value as a Unicode string. Coordinates are in PDF user space, with the origin at the bottom-left corner of the page and units in points (1/72 inch). Reading the property returns the current field value (/V) decoded to WString; writing it updates the field and regenerates appearance streams so the new value renders on the next paint

Returns an empty string when Active is False, when the document has no AcroForm, or when no widget covers the coordinate. The match policy mirrors FormFieldInfoAt: widget rectangles only (no appearance-bound hit testing), topmost widget wins for overlaps. Writes are no-ops when the coordinate misses every widget

For checkbox and radio button widgets the value semantics follow the PDF spec — assigning 'Off' clears the field, assigning the value matching the widget’s /AP /N on-state name (commonly 'Yes' or the export value) ticks it. For text fields, anything you assign becomes the new /V contents. List / combo boxes accept the export value associated with one of the option entries. Use FormFieldInfoAt first to inspect the FieldType if the field type is uncertain

Remarks

Example

// Toggle a checkbox located at (120, 300) on the current page
if Pdf1.FormFieldAt[120.0, 300.0] = 'Off' then
  Pdf1.FormFieldAt[120.0, 300.0] := 'Yes'
else
  Pdf1.FormFieldAt[120.0, 300.0] := 'Off';

See Also

FormFieldInfoAt, HasFormFieldAt, FormField, FormFieldCount