ByteScout Premium Suite - C# - Find PDF Table And Extract As XML with PDF Extractor SDK - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Premium Suite – C# – Find PDF Table And Extract As XML with PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – C# – Find PDF Table And Extract As XML with PDF Extractor SDK

How to find PDF table and extract as XML with PDF extractor SDK in C# with ByteScout Premium Suite

This code in C# shows how to find PDF table and extract as XML with PDF extractor SDK with this how to tutorial

The sample source codes on this page shows how to find PDF table and extract as XML with PDF extractor SDK in C#. ByteScout Premium Suite is the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording. It can find PDF table and extract as XML with PDF extractor SDK in C#.

The SDK samples given below describe how to quickly make your application do find PDF table and extract as XML with PDF extractor SDK in C# with the help of ByteScout Premium Suite. 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! Further improvement of the code will make it more robust.

ByteScout provides the free trial version of ByteScout Premium Suite along with the documentation and source code samples.

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.Diagnostics; using Bytescout.PDFExtractor; namespace FindTableAndExtractAsXml { class Program { static void Main(string[] args) { // Create Bytescout.PDFExtractor.XMLExtractor instance XMLExtractor xmlExtractor = new XMLExtractor(); xmlExtractor.RegistrationName = "demo"; xmlExtractor.RegistrationKey = "demo"; // Create Bytescout.PDFExtractor.TableDetector instance TableDetector tableDetector = new TableDetector(); tableDetector.RegistrationKey = "demo"; tableDetector.RegistrationName = "demo"; // We should define what kind of tables we should detect. // So we set min required number of columns to 3 ... tableDetector.DetectionMinNumberOfColumns = 3; // ... and we set min required number of rows to 3 tableDetector.DetectionMinNumberOfRows = 3; // Load sample PDF document xmlExtractor.LoadDocumentFromFile(@".\sample3.pdf"); tableDetector.LoadDocumentFromFile(@".\sample3.pdf"); // Get page count int pageCount = tableDetector.GetPageCount(); for (int i = 0; i < pageCount; i++) { int t = 1; // Find first table and continue if found if (tableDetector.FindTable(i)) { do { // Set extraction area for XML extractor to rectangle received from the table detector xmlExtractor.SetExtractionArea(tableDetector.FoundTableLocation); // Export the table to XML file xmlExtractor.SavePageXMLToFile(i, "page-" + i + "-table-" + t + ".xml"); t++; } while (tableDetector.FindNextTable()); // search next table } } // Cleanup xmlExtractor.Dispose(); tableDetector.Dispose(); // Open first output file in default associated application (for demo purposes) ProcessStartInfo processStartInfo = new ProcessStartInfo("page-0-table-1.xml"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); } } }

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