PDFiumVCL Docs

FormFieldInfo property

이 API 항목은 식별자, 시그니처, 코드 블록, PDF 용어를 원래 형태로 유지합니다.
Component: TPdf  ·  Unit: PDFium
Full record describing a form field at a given index on the active page.

Syntax

property FormFieldInfo[Index: Integer]: TPdfFormFieldInfo; // read only

Description

FormFieldInfo returns a snapshot TPdfFormFieldInfo record for the form field widget annotation at the zero-based Index on the currently active page. The record provides a strongly typed view of one AcroForm field widget without having to crack the underlying FPDF_ANNOTATION handle. PDF 1.7 spec section 12.7 defines the underlying field types and flags.

The record carries the field Name (fully qualified path through any parent field group, e.g. "order.shipto.address"), the AlternateName used for accessible tooltips, the FieldType enumeration (fiPushButton, fiCheckBox, fiRadioButton, fiTextField, fiListBox, fiComboBox, fiSignature, or fiUnknown), the bit-set Flags (ffReadOnly, ffRequired, ffNoExport, …), the ExportValue as written to a FormData export, the Checked flag for boolean fields, the FontSize used for rendering, and the option-set arrays OptionLabels / OptionSelected used by combo and list boxes. Radio button widgets that belong to a group additionally fill GroupCount and GroupIndex.

Valid indices are 0 .. FormFieldCount - 1. The record is a value type; modifying its fields does not write back to the document. To change the value of a field, assign through FormField[Index]; to alter the flag bitmask call SetFormFieldFlagsAt. Reading is lazy — PDFium decodes Unicode field names, option labels and export values on demand — so cache the result when you iterate many fields multiple times.

Parameters

IndexZero-based widget index on the current page (0 .. FormFieldCount - 1).

Remarks

Example

var I, J: Integer;
var Info: TPdfFormFieldInfo;
for I := 0 to Pdf1.FormFieldCount - 1 do
begin
  Info := Pdf1.FormFieldInfo[I];
  Memo1.Lines.Add(Format('%s [%d] export=%s checked=%s',
    [Info.Name, Ord(Info.FieldType), Info.ExportValue, BoolToStr(Info.Checked, True)]));
  for J := 0 to High(Info.OptionLabels) do
    Memo1.Lines.Add(' ' + Info.OptionLabels[J]);
end;

See Also

FormField, FormFieldCount, FormFieldInfoAt, FormFieldAt, FormType