ByteScout Data Extraction Suite - C# - PDF files Parallel Processing 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 Data Extraction Suite – C# – PDF files Parallel Processing with PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • ByteScout Data Extraction Suite – C# – PDF files Parallel Processing with PDF Extractor SDK

PDF files parallel processing with PDF extractor SDK in C# with ByteScout Data Extraction Suite

PDF files parallel processing with PDF extractor SDK in C#

The samples of source code documentation give a quick and simple method to apply a required functionality into your application. PDF files parallel processing with PDF extractor SDK in C# can be applied with ByteScout Data Extraction Suite. ByteScout Data Extraction Suite is the bundle that includes three SDK tools for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK.

If you want to quickly learn then these fast application programming interfaces of ByteScout Data Extraction Suite for C# plus the guideline and the C# code below will help you quickly learn PDF files parallel processing with PDF extractor SDK. If you want to implement this functionality, you should copy and paste code below into your app using code editor. Then compile and run your application. Check these C# sample code examples to see if they acknowledge to your needs and requirements for the project.

Visit our website to get a free trial version of ByteScout Data Extraction Suite. Free trial contains many of source code samples to help you with your C# project.

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.IO; using System.Threading; using Bytescout.PDFExtractor; namespace Parallel_Processing { class Program { // Limit to 4 threads in queue. // Set this value to number of your processor cores for max performance. private static readonly Semaphore ThreadLimiter = new Semaphore(4, 4); static void Main(string[] args) { // Get all PDF files in a folder string[] files = Directory.GetFiles(@"..\..\..\..\", "*.pdf"); // Array of events to wait ManualResetEvent[] doneEvents = new ManualResetEvent[files.Length]; for (int i = 0; i < files.Length; i++) { // Wait for the queue ThreadLimiter.WaitOne(); // Start thread with filename and event in params doneEvents[i] = new ManualResetEvent(false); object[] threadData = new object[] { files[i], doneEvents[i] }; ThreadPool.QueueUserWorkItem(ConvertPdfToTxt, threadData); } // Wait until all threads finish WaitHandle.WaitAll(doneEvents); Console.WriteLine(); Console.WriteLine("All is done."); Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } private static void ConvertPdfToTxt(object state) { // Get filename and event from params string file = (string) ((object[]) state)[0]; ManualResetEvent doneEvent = (ManualResetEvent)((object[])state)[1]; string resultFileName = Path.GetFileName(file) + ".txt"; try { Console.WriteLine("Converting " + file); using (TextExtractor extractor = new TextExtractor("demo", "demo")) { extractor.LoadDocumentFromFile(file); extractor.SaveTextToFile(resultFileName); } Console.WriteLine("Finished " + resultFileName); } finally { // Signal the thread is finished doneEvent.Set(); // Release semaphore ThreadLimiter.Release(); } } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction 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 Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next