Winnovative Software Logo

 HTML to PDF Converter - Excel Library - ASP.NET Charts - RTF to PDF Converter
 PDF Merge and Split - PDF Security - PDF Viewers - PDF to Text - Images Extractor

 
Skip Navigation Links
 

Getting Started with PDF Split for .NET

 

Overview

 
The PDF split for .NET can be used in any type of application to split PDF documents. You can extract a range of pages from the PDF document or you can split the document in sections of the desired length. The downloaded archive contains the development libraries for .NET and a ready to use console application in the sample Samples\Bin folder. The source code for the command line tool is also available in the Samples folder.
 

PDF Split Development Library

 
The PDF Split develoment library 'wnvsplitpdf.dll' is a managed assembly that can be linked into any .NET application, either Win32 and console applications or ASP.NET web sites. The interface is very easy to be understood and use.

The main class in the assembly is PDFSplitManager. An instance of this class can be constructed by specifying the merged document options as an instance of the PDFDocumentOptions class or using the default document options (normal compression). If you need to change any of these settings you have to pass a PDFDocumentOptions object to the PDFMerge constructor. For a complete reference of the assembly classes and methods see the assembly reference documention in Help.chm document.

First you have to create an instance of the PDFSplitManager class and then call the split and extract methods. The PDFSplitManager class offers interfaces to split the document in chunks of the number of pages or extract a range of pages from the PDF document.

All the methods have versions working for the memory representation of the PDF document as an array of bytes or for PDF files.

The memory versions of the methods can be used to easily interface with the other PDF tools producing PDF documents in memory. The memory representation of a PDF document resulted after split is encapsulated by the PDFSplitDoc class. This class can be used to get the internal array of bytes or to save the PDF bytes into a file on the disk.

When you want to perform the split you can simply call the methods like ExtractPagesFromFileToFile, ExtractPagesFromFileToMemory, ExtractPagesFromMemoryToFile or ExtractPagesFromMemoryToMemory to perform the split or extract. There is also a method which gives you the number of pages from the PDF document GetPdfPageCount.

All the split process can be done in a few lines of code. You can specify if you want to repeat extracting document chunks until the end of the document is reached or to specify the number of chunks you want to extract.
1: PDFSplitManager splitManager = new PDFSplitManager();
2:  
3: if (repeatToEnd)
4:     splitManager.ExtractPagesFromFileToFile(srcPdfFile, outFile,
5:                      startPageNumber, splitPageCount,
true);
6: else
7:     splitManager.ExtractPagesFromFileToFile(srcPdfFile, outFile, 
8:                      startPageNumber, splitPageCount, repeatCount);
 

PDF Split Command Line Tool

 
  The PDF Split Command Line Tool is a simple application constructed based on the development libraries. It is also a ready to use application in case you don't need to build your own application. The command line syntax is:

splitpdf.exe /pdf:source_pdf_file [/startpage:start_page_number] [/splitsize:split_page_count] [/repeatcount:repeat_count] /out:out_file

In simple terms this syntax means that you can specify the source pdf file, the page where you want to start splitting, the size in pages of a resulted chunk,
the number of chunks you want to extract and the output file. By default, if no repeat count is specified, the tool will repeat extracting to the end of the
document. 

The out file is used to determine the path and the name of the extracted chunks. Each extracted chunk is written in a file containg the chunk index.

Command line example:

SplitPdf.exe /pdf:VSS_White_Paper.pdf  /startpage:1 /splitsize:3 /out:splitout.pdf
 

Licensing

 
The license files are expcted to be installed in the same folder with the wnvsplitpdf.dll assembly for the windows forms and console applications. If you want to change this default behavior you have to set the license file path accordingly using LicenseFilePath property of the SplitPDFManager class.