We regularly create and update our sample code library so you may quickly learn parallel barcode decoding with barcode reader sdk and the step-by-step process in VB.NET. ByteScout Data Extraction Suite helps with parallel barcode decoding with barcode reader sdk in VB.NET. 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.
Save time on writing and testing code by using the code below and use it in your application. Follow the steps-by-step instructions from the scratch to work and copy and paste code for VB.NET into your editor. Updated and detailed documentation and tutorials are available along with installed ByteScout Data Extraction Suite if you’d like to learn more about the topic and the details of the API.
Trial version can be downloaded from our website for free. It contains this and other source code samples for VB.NET.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
Imports Bytescout.BarCodeReader
Imports System.Threading
Module Module1
Const InputFile As String = ".\example.pdf"
' Limit to 4 threads in queue.
' Set this value to number of your processor cores for max performance.
Dim ThreadLimiter As Semaphore = New Semaphore(4, 4)
<MTAThread()> Sub Main()
Const numberOfRuns As Integer = 10
Dim doneEvents(numberOfRuns - 1) As ManualResetEvent
For i As Integer = 0 To numberOfRuns - 1
' Wait for the queue
ThreadLimiter.WaitOne()
doneEvents(i) = New ManualResetEvent(False)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf ThreadProc), New Object() {i, doneEvents(i)})
Next
WaitHandle.WaitAll(doneEvents)
Console.WriteLine("All threads done.")
Console.WriteLine()
Console.WriteLine("Press any key to exit...")
Console.ReadKey()
End Sub
Sub ThreadProc(ByVal stateInfo As Object)
Dim threadIndex As Integer = stateInfo(0)
Dim waitEvent As ManualResetEvent = stateInfo(1)
Console.WriteLine("Thread #" & threadIndex & " started...")
Try
Dim reader As New Reader()
reader.RegistrationName = "demo"
reader.RegistrationKey = "demo"
' Set barcode type to find
reader.BarcodeTypesToFind.Code128 = True
' -----------------------------------------------------------------------
' NOTE: We can read barcodes from specific page to increase performance .
' For sample please refer to "Decoding barcodes from PDF by pages" program.
' -----------------------------------------------------------------------
' Read barcodes
Dim barcodes As FoundBarcode() = reader.ReadFrom(InputFile)
' Cleanup
reader.Dispose()
Console.WriteLine("Thread #" & threadIndex & " finished with " & barcodes.Length & " barcodes found.")
Catch ex As Exception
Console.WriteLine("Thread #" & threadIndex & " failed with exception:\r\n" & ex.Message)
Finally
' Signal the thread is finished
waitEvent.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: