PDFOne .NET
Powerful all-in-one PDF library for .NET
Compatibility
VS 2008 VS 2005 CLR 2.0

How To Split PDF Documents Using PDFOne .NET

Learn how to split and reorganize PDF documents using PDFOne .NET and C#.
By V. Subhash

In this article, we focus on how to split PDF documents. The PDFDocument of PDFOne .NET offers several methods to split PDF documents.

// Copy specified pages to a specified file
// Copy specified pages and automatically name the output file
public void Split( 
   string pageRange
)
 
// Split the document by specified number of pages
public void Split( 
   int pages
)

public void ExtractPagesTo( 
   string path,
   string pageRange
)

In this code example, I try to split a 6-page PDF document in several ways.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gnostice.PDFOne;

namespace PDFOne_dotNET_Examples {
   class PDF_Merge {
      static void Main(string[] args) {
         PDFDocument doc = new PDFDocument("your-license-key");
            
         // Load a PDF document
         doc.Load(@"F:\My eBooks\airlinetrailbrochure.pdf");
            
         // Creates 2-4,6.pdf
         doc.Split("2-4,6");  

         // Creates 1-4.pdf and 5-6.pdf
         // doc.Split(4);

         // Creates even_page.pdf with pages 2, 4 and 6
         // doc.ExtractPagesTo("even_pages.pdf", "2,4,6");

         // Closes the PDF document
         doc.Close();
      }
   }
}

Here is the input document.

Original 6-page document

Here is the output of the first Split() method. The method uses the pagerange parameter to name the output file.

Output document with just the 4 pages

Here is the output of the second Split() method. The output files are name after their original first and last page numbers. Even though the last file has only 2 page, it will still be given the full benefit of the multiple!

Split by number of pages

The method ExtractPages simply names the output file with the name specified in the path parameter.

ExtractPages method allows you name the output file

---o0O0o---

Our Developer Tools
eDocEngine VCL

A Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools.

PDFtoolkit VCL

A Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents.

XtremePDFConverter VCL

A Delphi/C++Builder component to intelligently convert PDF to user-friendly Word RTF documents.

PDFOne .NET

A .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications.

XtremeDocumentStudio .NET

Multi-format document-processing component suite for .NET developers

PDFOne (for Java™)

A Java™ PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java™ applications.

XtremeFontEngine (for Java)

Java font engine to render glyphs from Type 1, Type 2 (CFF), and TrueType fonts

Our Office Productivity Applications
Free PDF Reader

A free, fast, and portable application for viewing, printing and converting PDF documents.

Privacy | Legal | Feedback | Newsletter | Resellers © 2002-2013 Gnostice Information Technologies Private Limited. All rights reserved.

This site is best viewed on a screen with minimum resolution of 1152 x 864 pixels. Windows XP users are advised to use Microsoft ClearType Tuning for optimal experience. Also, please use the latest version of a standards-compliant browser such as Firefox, Opera, or Dragon (Chromium).