Last active
December 23, 2020 10:36
-
-
Save GroupDocsGists/b64b2266ab7018b43e07dfa41aaa7cad to your computer and use it in GitHub Desktop.
Parse PDF forms and extract field values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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