These source code samples are assembled by their programming language and functions they apply. 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 and you can use it to remove empty pages with pdf extractor sdk with VB.NET.
Want to quickly learn? This fast application programming interfaces of ByteScout Data Extraction Suite for VB.NET plus the guidelines and the code below will help you quickly learn how to remove empty pages with pdf extractor sdk. IF you want to implement the functionality, just copy and paste this code for VB.NET below into your code editor with your app, 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.
The trial version of ByteScout Data Extraction Suite can be downloaded for free from our website. It also includes source code samples for VB.NET and other programming languages.
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 Bytescout.PDFExtractor
''' <summary>
''' The example demonstrates detection of empty pages, splitting the document to separate
''' pages excluding empty ones, then combine parts back to a single document.
''' </summary>
Module Module1
Dim InputFile = ".\sample.pdf"
Dim OutputFile = ".\result.pdf"
Dim TempFolder = ".\temp"
Sub Main()
' Create and setup Bytescout.PDFExtractor.TextExtractor instance
Dim extractor As New TextExtractor("demo", "demo")
' Load PDF document
extractor.LoadDocumentFromFile(InputFile)
' List to keep non-empty page numbers
Dim nonEmptyPages = New List(Of String)()
' Iterate through pages
For pageIndex = 0 To extractor.GetPageCount() - 1
' Extract page text
Dim pageText = extractor.GetTextFromPage(pageIndex)
' If extracted text is not empty keep the page number
If pageText.Length > 0 Then
nonEmptyPages.Add((pageIndex + 1).ToString())
End If
Next
' Cleanup
extractor.Dispose()
' Form comma-separated list of page numbers to split ("1,3,5")
Dim ranges As String = String.Join(",", nonEmptyPages)
' Create Bytescout.PDFExtractor.DocumentSplitter instance
Dim splitter = new DocumentSplitter("demo", "demo")
splitter.OptimizeSplittedDocuments = true
' Split document by non-empty in temp folder
Dim parts = splitter.Split(InputFile, ranges, TempFolder)
' Cleanup
splitter.Dispose()
' Create Bytescout.PDFExtractor.DocumentMerger instance
Dim merger = New DocumentMerger("demo", "demo")
' Merge parts
merger.Merge(parts, OutputFile)
' Cleanup
merger.Dispose()
' Delete temp folder
Directory.Delete(TempFolder, true)
' Open the result file in default PDF viewer (for demo purposes)
Process.Start(OutputFile)
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: