Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active June 16, 2022 11:38
Show Gist options
  • Save bjoerntx/301eb6654317c3ea4e81b558ffdf41e2 to your computer and use it in GitHub Desktop.
Save bjoerntx/301eb6654317c3ea4e81b558ffdf41e2 to your computer and use it in GitHub Desktop.
FormField[] acroForms = Forms.GetAcroFormFields("lease_agreement.pdf");
foreach (FormField field in acroForms) {
switch (field) {
case FormTextField textField:
Console.WriteLine("Field \"{0}\" extracted: {1}",
textField.FieldName,
textField.Value);
break;
case FormCheckBox checkBoxField:
Console.WriteLine("Field \"{0}\" extracted: {1}",
checkBoxField.FieldName,
checkBoxField.IsChecked.ToString());
break;
case FormComboBox comboBoxField:
Console.WriteLine("Field \"{0}\" extracted. Selected value: {1}",
comboBoxField.FieldName,
comboBoxField.Value);
foreach (var item in comboBoxField.Options) {
Console.WriteLine(" -> Option: {0}", item);
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment