How to Start Convert PDF Read PDF Edit PDF PDF Report Builder Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

C# PDF Form Library
How to read, extract field data from AcroForms in PDF file using C# code

C# Demo Code to read, extract field data from AcroForms in PDF file

In this C# tutorial, you will learn how to read, extract all PDF AcroForms fields data using C# in ASP.NET MVC Web, Windows applications.

  • Read all form fields data from PDF
  • Get field name, visibility, page index, position, and size from PDF

Retrieve all form fields from a PDF file in C#

The text below and C# source code will explain how to read all PDF AcroForms fields data using C#

  • Use PDFFormHandler.GetFormFields() method to get all form fileds in an existing PDF file
  • For each field extracted, you will get field's name, visibility, page index, page position, and field size

String inputFilePath = Program.RootPath + "\\" + "1_AF.pdf";

List<BaseFormField> fields = PDFFormHandler.GetFormFields(inputFilePath);
Console.WriteLine("Number of Fields: " + fields.Count);
if (fields.Count > 0)
    foreach (BaseFormField field in fields)
        Console.WriteLine("  Name:     " + field.Name);
        Console.WriteLine("  Visible:  " + field.IsVisible);
        Console.WriteLine("  Page:     " + field.PageIndex);
        Console.WriteLine("  Position: " + field.Position.ToString());
        Console.WriteLine("  Size: " + field.Size.ToString());