Extract data from PDF forms

GroupDocs.Parser allows to parse form data from PDF documents.

To extract PDF form data please call the ParseForm method:

DocumentData ParseForm()

This method returns an instance of DocumentData class with the extracted data.

Here are the steps to parse form of the document:

  • Instantiate Parser object for the initial document
  • Call ParseForm method and obtain the DocumentData object;
  • Check if data isn’t null (parse form is supported for the document);
  • Iterate over field data to obtain form data.

The following example shows how to parse a form of the document:

// Create an instance of Parser class
using (Parser parser = new Parser(filePath))
    // Extract data from PDF document
    DocumentData data = parser.ParseForm();
    // Check if form extraction is supported
	if(data == null) {
		Console.WriteLine("Form extraction isn't supported.");
    // Iterate over extracted 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);

More resources

Advanced usage topics

To learn more about document data extraction features and get familiar how to extract text, images, forms and more, please refer to the advanced usage section.

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document parser App

Along with full featured .NET library we provide simple, but powerful free Apps.

You are welcome to extract text, metadata and images from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Parser App.

© Aspose Pty Ltd 2001-2022. All Rights Reserved.