Split pdf document by found barcode with barcode reader sdk is simple to apply in VB.NET if you use these source codes below. 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. It can split pdf document by found barcode with barcode reader sdk in VB.NET.
The SDK samples given below describe how to quickly make your application do split pdf document by found barcode with barcode reader sdk in VB.NET with the help of ByteScout Data Extraction Suite. Just copy and paste the code into your VB.NET application’s code and follow the instructions. This basic programming language sample code for VB.NET will do the whole work for you to split pdf document by found barcode with barcode reader sdk.
You can download free trial version of ByteScout Data Extraction Suite from our website with 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 System.IO Imports System.Text Imports Bytescout.BarCodeReader Module Module1 Sub Main() Const inputFile As String = "Barcodes.pdf" Console.WriteLine("Reading barcode(s) from image {0}", Path.GetFullPath(inputFile)) ' Create Bytescout.BarCodeReader.Reader instance Dim reader As New Reader() reader.RegistrationName = "demo" reader.RegistrationKey = "demo" ' Set barcode type to find reader.BarcodeTypesToFind.Code39 = True ' ----------------------------------------------------------------------- ' NOTE: We can read barcodes from specific page to increase performance . ' For sample please refer to "Decoding barcodes from PDF by pages" program. ' ----------------------------------------------------------------------- ' Find barcode in PDF document reader.ReadFrom(inputFile) ' Method 1: Split PDF document in two parts by found barcode ' NOTE: In Full version of the SDK this method is unlocked in "PRO" license type only reader.SplitDocument("barcodes.pdf", "part1.pdf", "part2.pdf", reader.FoundBarcodes(0).Page + 1) ' Method 2: Extract page containing the barcode from PDF document ' NOTE: In Full version of the SDK this method is unlocked in "PRO" license type only reader.ExtractPageFromDocument("barcodes.pdf", "extracted_page.pdf", reader.FoundBarcodes(0).Page + 1) ' Method 3: Split PDF document into parts in one pass. ' NOTE: In Full version of the SDK this method is unlocked in "PRO" license type only. Dim pageRanges As StringBuilder = New StringBuilder() ' Create string containing page ranges to extract in the form "1-4,6-8,10-11,12-". Page numbers are 1-based! For i As Integer = 0 To reader.FoundBarcodes.Length - 1 Dim barcode As FoundBarcode = reader.FoundBarcodes(i) ' Add pages before the first barcode found If i = 0 And barcode.Page > 0 Then pageRanges.Append("1") If barcode.Page > 1 Then pageRanges.Append("-") pageRanges.Append(barcode.Page) End If pageRanges.Append(",") End If ' Add page with barcode pageRanges.Append(barcode.Page + 1) ' +1 because we skip the page with barcode and another +1 because need 1-based page numbers ' Add range untill the next barcode If i < reader.FoundBarcodes.Length - 1 Then If reader.FoundBarcodes(i + 1).Page - barcode.Page > 1 Then pageRanges.Append("-") pageRanges.Append(reader.FoundBarcodes(i + 1).Page) End If pageRanges.Append(",") Else ' for the last found barcode add ending "-" meaning "to the last page" pageRanges.Append("-") End If Next ' Split document Dim splittedParts As String() = reader.SplitDocument("barcodes.pdf", pageRanges.ToString()) ' The method returns array of file names. Rename files as desired. ' Cleanup reader.Dispose() For Each fileName As String In splittedParts Console.WriteLine(fileName) Next Console.WriteLine("Press enter key to exit...") Console.ReadLine() 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: