Watch the Video
How to Split PDF pages
Splitting a PDF in multiple PDFs using DynamicPDF Core Suite is a straightforward, the following steps and sample code illustrate.
Steps to Split a PDF
- Create a
PdfDocument
object and pass the source PDF file path to the constructor. - Create a
MergeDocument
object and in the constructor pass thePdfDocument
object instance, the starting page number, and ending page count. - Invoke the
Document
object'sDraw
method to output the PDF portion specified by the starting page number and ending page count. - Repeat step 2 and 3, only pass 5, and 9 to the
MergeDocument
constructor. - Invoke the
Draw
method, and a new PDF starting at page 5 and ending at page 12 is output to a new PDF document.
Sample Code - C#
PdfDocument pdf = new PdfDocument("TimeMachine.pdf");
MergeDocument part1 = new MergeDocument(pdf, 1, 4);
Part1.Draw("output-part1.pdf");
MergeDocument part2 = new MergeDocument(pdf, 5, 8);
part2.Draw("output-part2.pdf");
GitHub Project
Clone or view the example project at GitHub. This example code is contained in the Examples/SplitPDF.cs file.
Getting Started
NuGet Package
DynamicPDF Core Suite is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET
package. The easiest way to install the package is through the Visual Studio Package Manager. You can also download the package directly from NuGet.
DynamicPDF Core Suite Information
DynamicPDF Core Suite contains over 75 page elements so you can add rich content to the PDFs you create:
- Images
- Text Objects (TextArea and Label)
- HTML
- Barcodes (47 types)
- Form Fields
- Charts
More information can be found on the DynamicPDF Core Suite webpage.
Available on Other Platforms
DynamicPDF Core Suite is available for the Java and COM/ActiveX platforms. Refer to the respective product pages for more details.
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX