Extract data from PDF Forms via C#

Extract user data fields from fillable PDF document via C#. Build your own .NET apps using server-side APIs.

Download

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

System Requirements


Aspose.PDF for C# is supported on all major operating systems. Just make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with .NET Framework, .NET Core, and PHP, VBScript, Delphi, C++ via COM Interop.
  • Development environment like Microsoft Visual Studio.
  • Aspose.PDF for .NET DLL referenced in your project.

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);
    }

About Aspose.PDF for C# API

A PDF Processing Library to create cross-platform applications with the ability to generate, modify, convert, render, secure and print documents without using Adobe Acrobat. It supports converting various file formats into PDF including HTML and converting PDF documents into various output formats. Developers can easily render all HTML content in a single Page PDF as well as convert HTML files with SVG graphic tags to Tagged PDF files. .NET PDF API offers compression, table creation, graph & image functions, hyperlinks, stamp and watermarking tasks, extended security controls & custom font handling.