Learn how to read values from PDF form fields in C# with this source code sample. What is ByteScout PDF Extractor SDK? It is the SDK is designed to help developers with pdf tables and pdf data extraction from unstructured documents like pdf, tiff, scans, images, scanned and electronic forms. The library is powered by OCR, computer vision and AI to provide unique functionality like table detection, automatic table structure extraction, data restoration, data restructuring and reconstruction. Supports PDF, TIFF, PNG, JPG images as input and can output CSV, XML, JSON formatted data. Includes full set of utilities like pdf splitter, pdf merger, searchable pdf maker and other utilities. It can help you to read values from PDF form fields in your C# application.
C# code samples for C# developers help to speed up coding of your application when using ByteScout PDF Extractor SDK. 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! Test C# sample code examples whether they respond your needs and requirements for the project.
Free trial version of ByteScout PDF Extractor SDK is available for download from our website. Get it to try other source code samples for C#.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
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(); } } }
60 Day Free Trial or Visit ByteScout PDF Extractor SDK Home Page
Explore ByteScout PDF Extractor SDK Documentation
Explore Samples
Sign Up for ByteScout PDF Extractor SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout PDF Extractor SDK Home Page
Explore ByteScout PDF Extractor SDK Documentation
Explore Samples
Sign Up for ByteScout PDF Extractor SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: