Split a Multi-Page Document into a Single PDF
Splitting a multi-page PDF document into separate PDFs, each containing one page, can be done with just a couple of 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 containing only one page.
Get started with IronPDF
Start using IronPDF in your project today with a free trial.
Split a Multipage PDF
Now that you have IronPDF, you can take a multipage document and split it into single-page document files. The idea of splitting a multipage PDF involves copying a single or multiple pages using the CopyPage
or CopyPages
method.
:path=/static-assets/pdf/content-code-examples/how-to/split-multipage-pdf-split-pdf.cs
using IronPdf;
PdfDocument pdf = PdfDocument.FromFile("multiPage.pdf");
for (int idx = 0; idx < pdf.PageCount; idx++)
{
// Create new document for each page
PdfDocument outputDocument = pdf.CopyPage(idx);
string fileName = @$"multiPage - Page {idx + 1}_tempfile.pdf";
// Export to new file
outputDocument.SaveAs(fileName);
}
Imports IronPdf
Private pdf As PdfDocument = PdfDocument.FromFile("multiPage.pdf")
For idx As Integer = 0 To pdf.PageCount - 1
' Create new document for each page
Dim outputDocument As PdfDocument = pdf.CopyPage(idx)
Dim fileName As String = $"multiPage - Page {idx + 1}_tempfile.pdf"
' Export to new file
outputDocument.SaveAs(fileName)
Next idx
Looking at the code above, you can see that it uses a for
loop to iterate through the current PDF document's pages, then uses the CopyPage
method to copy each page into a new PdfDocument object. Finally, each page is exported as a new document named sequentially.
Ready to see what else you can do? Check out our tutorial page here: Organize PDFs
Frequently Asked Questions
How can I split a multipage PDF into single-page documents in C#?
You can use IronPDF in your C# project to split a multipage PDF into single-page documents. The process involves loading the original PDF and using the CopyPage
method to save each page as a separate PDF.
What are the steps to split a PDF document using IronPDF?
First, install the IronPDF library. Then, load your multipage PDF, iterate through each page using a for
loop, and use the CopyPage
method to create separate single-page PDFs.
Is it necessary to use a loop to split a PDF using IronPDF?
Yes, using a for
loop allows you to iterate through each page of the original PDF and copy them individually into new PDF documents using IronPDF.
Can I use IronPDF to save each page of a multipage PDF as a new document?
Absolutely, IronPDF allows you to save each page of a multipage PDF as a new document by iterating through the pages and using the CopyPage
method to export them as new PDFs.
What method should I use to copy pages when splitting PDFs?
When splitting PDFs with IronPDF, you can use the CopyPage
method to copy each page individually from the original document.
How can I install IronPDF in my C# project?
To install IronPDF in your C# project, you can use NuGet Package Manager to search for and install the IronPDF library, which enables PDF manipulation including splitting documents.
How efficient is it to split a PDF using IronPDF?
Splitting a PDF using IronPDF is very efficient and can be done with just a few lines of code, making it accessible for developers of all skill levels.
What programming language can be used with IronPDF to split PDFs?
IronPDF is designed to be used with C#, allowing you to easily split PDFs and perform other PDF manipulations within your C# projects.