Extract data from PDF Forms via C#

Extract user data fields from fillable PDF document. Use Aspose.PDF for .NET to modify PDF files programmatically

How to Extract data from PDF Forms using .NET Library

In order to extract data from PDF Forms (Acroforms) in a PDF file, we’ll use Aspose.PDF for .NET API, which is feature-rich, powerful, and easy-to-use document manipulation API for net platform. Open NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.

How to Extract AcroForm in PDF using C#


You need Aspose.PDF for .NET to try the code in your environment.

  1. Load PDF in an instance of Document class.
  2. Get values from all fields using Document.Form class.
  3. Analyze names and values if needed.
  4. Load PDF in an instance of Document class
  5. Get values from all fields using Document.Form class

Extract data from PDF Forms - C#

This sample code shows how to Extract data from PDF Forms in PDF using C#

// Open document
Document pdfDocument = new Document(dataDir + "GetValuesFromAllFields.pdf");

// Get values from all fields
foreach (Field formField in pdfDocument.Form)
{
    // Analyze names and values if need
    Console.WriteLine("Field Name : {0} ", formField.PartialName);
    Console.WriteLine("Value : {0} ", formField.Value);
}