ByteScout PDF Extractor SDK - VB.NET - Parallel Processing of PDF files - ByteScout

ByteScout PDF Extractor SDK – VB.NET – Parallel Processing of PDF files

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Extractor SDK – VB.NET – Parallel Processing of PDF files

parallel processing of PDF files in VB.NET with ByteScout PDF Extractor SDK

parallel processing of PDF files in VB.NET

Every ByteScout tool contains example VB.NET source codes that you can find here or in the folder with installed ByteScout product. ByteScout PDF Extractor SDK was made to help with parallel processing of PDF files in VB.NET. ByteScout PDF Extractor SDK is the Software Development Kit (SDK) that is designed to help developers with 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.

You will save a lot of time on writing and testing code as you may just take the code below and use it in your application. In order to implement this functionality, you should copy and paste code below into your app using code editor. Then compile and run your application. Use of ByteScout PDF Extractor SDK in VB.NET is also explained in the documentation included along with the product.

Visit our website provides for free trial version of ByteScout PDF Extractor SDK. Free trial includes lots of source code samples to help you with your VB.NET project.

Try ByteScout PDF Extractor SDK today: Get 60 Day Free Trial or sign up for Web API

Module1.vb
      
Imports System.IO Imports System.Threading Imports Bytescout.PDFExtractor Module Module1 ' Limit to 4 threads in queue. ' Set this value to number of your processor cores for max performance. ReadOnly ThreadLimiter As Semaphore = New Semaphore(4, 4) <MTAThread()> Sub Main() ' Get all PDF files in a folder Dim files = Directory.GetFiles("..\..\..\..\", "*.pdf") ' Array of events to wait Dim doneEvents(files.Length - 1) As ManualResetEvent For i As Integer = 0 To files.Length - 1 ' Wait for the queue ThreadLimiter.WaitOne() ' Start thread with filename and event in params doneEvents(i) = New ManualResetEvent(False) Dim threadData As Object = New Object() {files(i), doneEvents(i)} ThreadPool.QueueUserWorkItem(AddressOf ConvertPdfToTxt, threadData) Next ' 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() End Sub Private Sub ConvertPdfToTxt(ByVal state As Object) ' Get filename and event from params Dim file As String = state(0) Dim doneEvent As ManualResetEvent = state(1) Dim resultFileName = Path.GetFileName(file) + ".txt" Try Console.WriteLine("Converting " + file) Using extractor As New TextExtractor("demo", "demo") extractor.LoadDocumentFromFile(file) extractor.SaveTextToFile(resultFileName) End Using Console.WriteLine("Finished " + resultFileName) Finally ' Signal the thread is finished doneEvent.Set() ' Release semaphore ThreadLimiter.Release() End Try End Sub End Module

Try ByteScout PDF Extractor SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

VIDEO

ON-PREMISE VERSION

Get 60 Day Free Trial or Visit ByteScout PDF Extractor SDK page

Explore ByteScout PDF Extractor SDK documentation

WEB API

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next