ImageEn, unit iexPdfiumCore |
|
TPdfFormField.FieldType
Declaration
property FieldType: TPdfFormFieldType;
Description
Returns the type of the annnotation field.
Read-only
// Output all field values to a memo
Memo1.Clear();
Memo1.Lines.Add( Format( 'Form Fields: %d', [ ImageEnView1.PdfViewer.FormFields.Count ]));
for i := 0 to ImageEnView1.PdfViewer.FormFields.Count -1 do
Memo1.Lines.Add( Format( '%s (%s): %s', [ ImageEnView1.PdfViewer.FormFields[i].Name, PdfFormFieldTypeToStr( ImageEnView1.PdfViewer.FormFields[i].FieldType ), ImageEnView1.PdfViewer.FormFields[i].Value ]));
function PdfFormFieldTypeToStr(v: TPdfFormFieldType): string;
begin
case v of
fftPushButton : Result := 'Button';
fftCheckBox : Result := 'Checkbox';
fftRadioButton : Result := 'Radio Button';
fftComboBox : Result := 'ComboBox';
fftListBox : Result := 'ListBox';
fftTextField : Result := 'Text';
fftSignature : Result := 'Signature';
fftXFA : Result := 'XFA';
fftXFACheckBox : Result := 'XFA Checkbox';
fftXFAComboBox : Result := 'XFA ComboBox';
fftXFAImageField : Result := 'XFA Image';
fftXFAListBox : Result := 'XFA ListBox';
fftXFAPushButton : Result := 'XFA Button';
fftXFASignature : Result := 'XFA Signature';
fftXFATextField : Result := 'XFA Text';
else
// fftUnknown
Result := 'Unknown';
end;
end;
// Clear all form field values
for i := 0 to ImageEnView1.PdfViewer.FormFields.Count -1 do
case ImageEnView1.PdfViewer.FormFields[i].FieldType of
fftCheckBox : ImageEnView1.PdfViewer.FormFields[i].Checked := False;
fftTextField : ImageEnView1.PdfViewer.FormFields[i].Value := '';
else
// Default handling
ImageEnView1.PdfViewer.FormFields[i].Value := '';
end;
ImageEnView1.Update();
// Set all text and checkbox values
for i := 0 to ImageEnView1.PdfViewer.FormFields.Count -1 do
case ImageEnView1.PdfViewer.FormFields[i].FieldType of
fftTextField : ImageEnView1.PdfViewer.FormFields[i].Value := 'ImageEn';
fftCheckBox : ImageEnView1.PdfViewer.FormFields[i].Checked := TRUE;
end;
ImageEnView1.Update();
// Toggle all checkboxes in the current page
for i := 0 to ImageEnView1.PdfViewer.FormFields.Count -1 do
if ImageEnView1.PdfViewer.FormFields[i].FieldType = fftCheckBox then
ImageEnView1.PdfViewer.FormFields[i].Checked := NOT ImageEnView1.PdfViewer.FormFields[i].Checked;
ImageEnView1.Update();