PDF .NET Library Logo
Home Products Code Library Online Demos Support Forum Buy About Us  
Code Library

How to split PDF files

This sample code creates a separate PDF document for each page of an existing PDF document. Files will be named as "filename-0.pdf" to "filename-N.pdf"

c# sample 1:

PDFOperation op = new PDFOperation("samplesplitfile.pdf", "");

op.SplitFile("split.pdf");

op.Close();

The sample below uses "SplitFileInfo" class for custom splitting.

Page 1 through 3 will be filed as "Page 1-3.pdf".

Page 2 through 4 will be filed as "Page 2-4.pdf".

c# sample 2:

PDFOperation op = new PDFOperation("samplesplitfile.pdf", "");

SplitFileInfo info1 = new SplitFileInfo();

info1.beginPageNumber = 1;

info1.endPageNumber = 3;

info1.fileName = "Page 1-3.pdf";

SplitFileInfo info2 = new SplitFileInfo();

info2.beginPageNumber = 2;

info2.endPageNumber = 4;

info2.fileName = "Page 2-4.pdf";

op.SplitFile(new SplitFileInfo[]{ info1, info2 });

op.Close();

Back to PDF Code Library