property FormFieldCount: Integer; // read only
FormFieldCount는 현재 활성 page의 AcroForm field widget annotation 수를 반환합니다. 각 entry는 하나의 widget annotation(/Widget subtype과 /FT field type)을 뜻하며, text input, check box, radio button, list box, combo box, push button, signature field가 여기에 해당합니다(PDF 1.7 spec 12.7절)
Active가 False이거나, 문서가 AcroForm이 아니거나(FormType = ftNone), page에 interactive widget이 없으면 값은 0입니다. 이것은 page별 metric이며, page에는 document tree의 다른 곳에 정의된 같은 logical field에 속한 widget이 들어 있을 수 있습니다 — PDF는 하나의 field가 여러 widget placement를 가질 수 있게 허용합니다(예: 표지와 마지막 page에 보이는 signature)
FormFieldInfo[Index]를 0부터 FormFieldCount - 1까지의 index로 사용하면 TPdfFormFieldInfo record를 얻을 수 있습니다: field type, name, alternate name, flag, option label, current value, export value, checked state, font size가 들어 있습니다. page coordinate를 hit test해 field를 얻으려면 대신 FormFieldAt[X, Y]나 FormFieldInfoAt[X, Y]를 사용하세요
FormType = ftXfaFull)는 interactive structure를 AcroForm tree 밖에 둡니다; FormFieldCount는 여전히 XFA가 생성한 widget을 보고할 수 있지만, XFA rendering 자체는 PDFiumPas의 범위를 벗어납니다FormFieldCount와 AnnotationCount는 겹칩니다. field만 원할 때 이 property를 사용하세요SetFormField로 widget을 삽입하거나 제거하면 index가 무효화됩니다. 각 mutation 후 FormFieldCount를 다시 읽으세요
var I: Integer;
var Info: TPdfFormFieldInfo;
for I := 0 to Pdf1.FormFieldCount - 1 do
begin
Info := Pdf1.FormFieldInfo[I];
Memo1.Lines.Add(Format('%s = %s', [Info.Name, Info.ExportValue]));
end;