ByteScout Premium Suite - C# - Read Values from PDF Form Fields with PDF Extractor SDK - ByteScout

ByteScout Premium Suite – C# – Read Values from PDF Form Fields with PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – C# – Read Values from PDF Form Fields with PDF Extractor SDK

How to read values from PDF form fields with PDF extractor SDK in C# using ByteScout Premium Suite

Learning is essential in computer world and the tutorial below will demonstrate how to read values from PDF form fields with PDF extractor SDK in C#

The code displayed below will guide you to install an C# app to read values from PDF form fields with PDF extractor SDK. What is ByteScout Premium Suite? It is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording. It can help you to read values from PDF form fields with PDF extractor SDK in your C# application.

Want to save time? You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout Premium Suite for read values from PDF form fields with PDF extractor SDK below and use it in your application. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Use of ByteScout Premium Suite in C# is also described in the documentation included along with the product.

The trial version of ByteScout Premium Suite can be downloaded for free from our website. It also includes source code samples for C# and other programming languages.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System; using System.Xml; using Bytescout.PDFExtractor; namespace ReadValuesFromFormFields { class Program { static void Main(string[] args) { try { // Create XMLExtractor interface using (XMLExtractor extractor = new XMLExtractor("demo", "demo")) { // Load Sample PDF document extractor.LoadDocumentFromFile("filled_form.pdf"); // Get PDF document text as XML string xmlText = extractor.GetXML(); // Load XML XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(xmlText); // Select all "control" nodes XmlNodeList formControls = xmlDocument.SelectNodes("//control"); if (formControls != null) { foreach (XmlNode formControl in formControls) { XmlAttribute typeAttribute = formControl.Attributes["type"]; // Get filled textboxes if (typeAttribute.Value == "editbox") { if (!string.IsNullOrEmpty(formControl.InnerText)) { Console.WriteLine("EDITBOX " + formControl.Attributes["id"].Value + ": " + formControl.InnerText); } } // Get checked checkboxes else if (typeAttribute.Value == "checkbox") { if (formControl.Attributes["state"].Value == "1") { Console.WriteLine("CHECKBOX " + formControl.Attributes["id"].Value + ": " + formControl.Attributes["state"].Value); } } } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadLine(); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next