Split a Multi-Page Document into a Single PDF

Splitting a multi-page PDF document into just one single PDF can be done with just a couple lines of code. See our example to implement it in your project.

With IronPDF it is very easy to split a single PDF document into multiple documents. Each document containing only one page.


Step 1

1. Install IronPDF to your C# Project

The first step to splitting a PDF document with just a couple lines of code will be to install the IronPDF library to your C# project. Download it free or install for free using NuGet and Visual Studio.


 PM > Install-Package IronPdf

How to Tutorial

2. Split a Multipage PDF

Now that you have IronPDF, you can take a multiple page document and split them into single page document files.

Here is a quick example:

/**
Split a Multipage PDF
anchor-split-a-multipage-pdf
**/

for (int idx = 0; idx < doc.PageCount; idx++)

{

// create new document for each page and save it to a new file

using PdfDocument outputDocument = doc.CopyPage(idx);

outputDocument.SaveAs(String.Format(@"{0}\{1} - Page {2}_tempfile.pdf", extractPath, name, idx + 1));

}
/**
Split a Multipage PDF
anchor-split-a-multipage-pdf
**/

for (int idx = 0; idx < doc.PageCount; idx++)

{

// create new document for each page and save it to a new file

using PdfDocument outputDocument = doc.CopyPage(idx);

outputDocument.SaveAs(String.Format(@"{0}\{1} - Page {2}_tempfile.pdf", extractPath, name, idx + 1));

}
'''
'''Split a Multipage PDF
'''anchor-split-a-multipage-pdf
'''*

For idx As Integer = 0 To doc.PageCount - 1


' create new document for each page and save it to a new file

Using outputDocument As PdfDocument = doc.CopyPage(idx)
	
	outputDocument.SaveAs(String.Format("{0}\{1} - Page {2}_tempfile.pdf", extractPath, name, idx + 1))
	
End Using
Next idx
VB   C#

If you look at the above code, you will see that you have made use of a for loop to loop through the current PDF document’s pages, then you made use of the CopyPage method to export the current page to a new document.