Parse PDF forms and extract field values
// Parse the filled PDF Form to extract field values in C# | |
using (Parser parser = new Parser("filePath/PDFForm.pdf")) | |
{ | |
// Extract data from PDF Form | |
DocumentData data = parser.ParseForm(); | |
// Iterate over the extracted PDF Form fields data | |
for (int i = 0; i < data.Count; i++) | |
{ | |
Console.Write(data[i].Name + ": "); | |
PageTextArea area = data[i].PageArea as PageTextArea; | |
Console.WriteLine(area == null ? "Not a template field" : area.Text); | |
} | |
} |
// Parse the filled PDF Form to extract field values using Java API of GroupDocs.Parser | |
Parser parser = new Parser("filePath/PDFForm.pdf"); | |
// Extract data from PDF Form | |
DocumentData data = parser.parseForm(); | |
// Iterate over the extracted PDF form data | |
for (int i = 0; i < data.getCount(); i++) { | |
System.out.print(data.get(i).getName() + ": "); | |
PageTextArea area = (data.get(i).getPageArea() instanceof PageTextArea) | |
? (PageTextArea) data.get(i).getPageArea() | |
: null; | |
System.out.println(area == null ? "Not a template field" : area.getText()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment