XDoc.PDF
Features
Tech Specs
How-to C#
How-to VB.NET
Pricing
C# PDF: How to PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF Viewer & Editor Work with Other SDKs Barcode Read Barcode Create OCR Twain
Data: Read, Extract Field Data
  |  
Home ›› XDoc.PDF ›› C# PDF: Read, Extract Field Data

C#.NET PDF SDK - Read and Extract Field Data in C#.NET


Help to Read and Extract Field Data from PDF with a Convenient C# Solution in .NET Application




A best PDF document SDK library enable users abilities to read and extract PDF form data in Visual C#.NET WinForm and ASP.NET WebForm applications


Provide advanced .NET framework components for extracting data from PDF file use Visual Studio .NET-compliant C# language


Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint


A professional PDF form reader control able to read PDF form field in C#.NET class


C# class source codes for collect data from PDF forms in Visual C# .NET program


Able to retrieve all form fields from adobe PDF file in C#.NET


Support to get form data from specified PDF form position


Special customization for export PDF form data to Excel spreadsheet in C#.NET


Generally, for a full-featured PDF software, it should have functions for processing text, image as well as field. RasterEdge .NET PDF SDK is such one provide various of form field edit functions. This page is mainly designed to tell you how to read or retrieve field data from PDF and how to extract and get field data from PDF in C#.NET project. C# demo codes listed below can help you have a quick evaluation of our PDF SDK.





C#.NET Demo Code: Get Filled Data in Fields in C#.NET


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.




String inputFilePath = Program.RootPath + "\\" + "1_AF_Filled.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("Field");
        Console.WriteLine("  Name:      " + field.Name);

        if (field is AFCheckBox)
        {
            Console.WriteLine("  Type:      " + "CheckBox");
            Console.WriteLine("  IsChecked: " + ((AFCheckBox)field).IsChecked);
        }
        else if (field is AFRadioButton)
        {
            Console.WriteLine("  Type:      " + "RadioButton");
            Console.WriteLine("  IsChecked: " + ((AFRadioButton)field).IsChecked);
        }
        else if (field is AFTextBox)
        {
            Console.WriteLine("  Type:      " + "TextBox");
            Console.WriteLine("  Content:   " + ((AFTextBox)field).Text);
        }
        else if (field is AFListBox)
        {
            Console.WriteLine("  Type:                " + "ListBox");
            Console.WriteLine("  Selected Item Index: " + ((AFListBox)field).SelectedIndexes[0]);
        }
        else if (field is AFComboBox)
        {
            Console.WriteLine("  Type:                " + "ComboBox");
            Console.WriteLine("  Selected Item Index: " + ((AFComboBox)field).SelectedIndex);
        }
    }
}




.NET Class Namespace Required



In order to run the sample code, the following steps would be necessary.


Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PDF;