Quickly learn how to split document with pdf extractor sdk in VB.NET with this sample source code. Want to split document with pdf extractor sdk in your VB.NET app? ByteScout Premium Suite is designed for it. ByteScout Premium Suite is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.
The following code snippet for ByteScout Premium Suite works best when you need to quickly split document with pdf extractor sdk in your VB.NET application. This VB.NET sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Further improvement of the code will make it more robust.
You can download free trial version of ByteScout Premium Suite from our website to see and try many others source code samples for VB.NET.
' This example demonstrates various PDF document splitting scenarios: ' - extract a single page; ' - split in two parts; ' - split by ranges specified in text form: "1-5,6,7-10,11-". Imports System.IO Imports Bytescout.PDFExtractor Class Program Friend Shared Sub Main(args As String()) Dim inputFile As String = "sample.pdf" Using splitter As New DocumentSplitter("demo", "demo") splitter.OptimizeSplittedDocuments = True ' Extracting specific page: ' ========================= splitter.ExtractPage(inputFile, "page3.pdf", 3) ' (!) Note: page number is 1-based. Console.WriteLine("Extracted page 3 to file ""page3.pdf""") Console.WriteLine() ' Split in two parts: ' =================== splitter.Split(inputFile, "part1.pdf", "part2.pdf", 3) ' (!) Note: page number is 1-based. Console.WriteLine("Splitted at page 3 to files ""part1.pdf"" and ""part2.pdf""") Console.WriteLine() ' Split by ranges: ' ================ Dim files As String() = splitter.Split(inputFile, "1-3,4-6,7,8-") ' (!) Note: page numbers are 1-based; ending "-" means "to the end". Console.WriteLine("Splitted by ranges: ") For Each file As String In files Console.WriteLine(" " & Path.GetFileName(file)) Next End Using Console.WriteLine() Console.WriteLine("Press any key...") Console.ReadKey() End Sub End Class