Click or drag to resize
Getting Started with ExpertPdf PDF Split Library for .NET. PDF pages extractor tool.

The ExpertPdf PDF Split Library for .NET can be used in any type of .NET application to split PDF documents or extract pages from PDF documents. Using the library customizations, you can extract a range of pages from the PDF document or you can split the document in sections of the desired length. The product archive contains the development libraries for .NET 2.0 or .NET 4.0 and a ready to use console application in the Samples folder (written in C# and VB.NET).

PDF Split Development Library

The ExpertPdf PDF Split develoment library epsplitpdf.dll is a managed assembly that can be linked into any .NET application, either Windows Forms and console applications or ASP.NET 2.0/4.0 web sites. The interface is very easy to use and understand.

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 PDFSplitManager constructor. For a complete reference of the assembly classes and methods see the API section of this manual.

To start working with the PDF Splitter, 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.

Code Sample

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.

PDFSplitManager splitManager = new PDFSplitManager();

if (repeatToEnd) {
    splitManager.ExtractPagesFromFileToFile(srcPdfFile, outFile, startPageNumber, splitPageCount, true);
}
else {
    splitManager.ExtractPagesFromFileToFile(srcPdfFile, outFile, 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 LicenseKey property of the PDFSplitManager class should be set with the license key string you have received after the product purchase.