ByteScout PDF Suite - VB.NET - Remove empty pages with pdf extractor sdk - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout PDF Suite – VB.NET – Remove empty pages with pdf extractor sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – VB.NET – Remove empty pages with pdf extractor sdk

How to remove empty pages with pdf extractor sdk in VB.NET using ByteScout PDF Suite

Continuous learning is a crucial part of computer science and this tutorial shows how to remove empty pages with pdf extractor sdk in VB.NET

The documentation is designed for a specific purpose to help you to apply the features on your side. ByteScout PDF Suite is the bundle that provides six different SDK libraries to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript. It can be applied to remove empty pages with pdf extractor sdk using VB.NET.

The following code snippet for ByteScout PDF Suite works best when you need to quickly remove empty pages with pdf extractor sdk in your VB.NET application. 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. Applying VB.NET application mostly includes various stages of the software development so even if the functionality works please test it with your data and the production environment.

The trial version of ByteScout PDF 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)

Module1.vb
      
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

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next