Split PDF programmatically

Live Example

Aspose.PDF Splitter is an online free web application that allows you to investigate how presentation splitting functionality works.

Aspose Split PDF

This topic shows how to split PDF pages into individual PDF files in your .NET applications. To split PDF pages into single page PDF files using C#, the following steps can be followed:

  1. Loop through the pages of PDF document through the Document object’s PageCollection collection
  2. For each iteration, create a new Document object and add the individual Page object into the empty document
  3. Save the new PDF using Save method

The following C# code snippet shows you how to split PDF pages into individual PDF files.

// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_Pages();

// Open document
Document pdfDocument = new Document(dataDir + "SplitToPages.pdf");

int pageCount = 1;

// Loop through all the pages
foreach (Page pdfPage in pdfDocument.Pages)
    Document newDocument = new Document();
    newDocument.Save(dataDir + "page_" + pageCount + "_out" + ".pdf");