Source code documentation samples give simple and easy method to install a needed feature into your application. ByteScout Premium Suite is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording and you can use it to remove empty pages with pdf extractor sdk with VB.NET.
Want to save time? You will save a lot of time on writing and testing code as you may just take the VB.NET code from ByteScout Premium Suite for remove empty pages with pdf extractor sdk below and use it in your application. Just copy and paste the code into your VB.NET application’s code and follow the instructions. Want to see how it works with your data then code testing will allow the function to be tested and work properly.
ByteScout provides the free trial version of ByteScout Premium Suite along with the documentation and source code samples.
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