These source code samples are assembled by their programming language and functions they use. Parallel processing of pdf files with pdf extractor sdk in VB.NET 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 VB.NET plus the guideline and the VB.NET code below will help you quickly learn parallel processing of pdf files 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. Use of ByteScout Data Extraction Suite in VB.NET is also described in the documentation included along with the product.
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 VB.NET project.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
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
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: