C# PDF Merge Split Library
How to split PDF pages by file size, PDF bookmark using C#.net code in ASP.NET MVC, Windows Forms
High quality PDF document splitter and cutter: full C# souce code to split PDF document apart in Visual C#.NET Application. Online Free Trial Download.
In this C# tutorial, you learn how to split, separate PDF document pages in the C# ASP.NET and Windows application
- Split a PDF file
- Split multiple PDF files
- Split PDF by number of pages, output file size, pdf bookmarks
How to seperate PDF pages using C#
- Best .NET PDF SDK control for splitting PDF document in Visual C# .NET project
- High quality PDF separator and breaker component for integration and splitting PDF file in both .NET WinForm console application and ASP.NET project
- C#.NET class source code for splitting PDF document in multiple methods in Visual Studio .NET program
- Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
- Able to split PDF document in preview on webpage in ASP.NET
- C# PDF splitter & cutter library for breaking PDF file into two or multiple files in .NET framework
- Support to break a large PDF file into smaller files
- Separate PDF file into single ones with defined pages
- Divide PDF file into multiple files by outputting PDF file size
- Split PDF document by PDF bookmark and outlines
C# PDF document splitting library control, XDoc.PDF, provides an advanced C# programming way to split PDF document into smaller PDF files in .NET developing applications.
Using this C#.NET PDF document splitting library control, C# developers can easily and accurately disassemble
multi-page PDF document into two or more separate PDF document files by page(s).
RasterEdge Visual C# .NET PDF document splitter control toolkit SDK can not only offer C# developers a professional .NET solution to split PDF document file
but also provide them the ability to name outputted PDF document files with a customized name pattern using a few lines of simple Visual C# code.
This C#.NET PDF document splitting library control offers developers an efficient PDF document splitting approach, using which C# developers
can split target PDF document file by specifying a page or pages. If needed, developers can also combine generated split PDF document files with other PDF files to
form a new PDF file using RasterEdge XDoc.PDF. Besides, in the process of splitting PDF document, developers can also remove certain PDF page
from target PDF file using C#.NET PDF page deletion API.
Please note, PDF file will be divided from the previous page of your defined page number which starts from 0. For example, your original PDF file contains 4 pages.
If your page number is set as 1, then the two output PDF files will contains the first page and the later three pages respectively.
How to split PDF pages to two PDF files using C# code?
The following steps and C# example source code will show how to split PDF pages to multiple PDF documents in C#.NET application.
The following C# example code will split a PDF file into 2 new PDF files.
- File 0: contains the first page of the source PDF file
- File 1: contains all remained pages
- Define a splitted page index. Here the var splitIndex is 1. So the page index 0 (the first page of the source PDF file) will be the only page in the first new PDF file. The second new PDF file will contain all the remaining pages.
- Create e a String array to contain the new PDF file paths
- Call PDFDocument.SplitDocument() to split the PDF pages into two new PDF files
String inputFilePath = Program.RootPath + "\\" + "1.pdf";
String outputFileName = "Output";
int splitIndex = 1; // valid value: 1 to (Page Count - 1)
List<String> outputFilePaths = new List<String>();
outputFilePaths.Add(Program.RootPath + "\\" + outputFileName + "_0.pdf");
outputFilePaths.Add(Program.RootPath + "\\" + outputFileName + "_1.pdf");
// split input file to 2 files, a file contains the first page of the input file,
// and another file contains all remained pages.
PDFDocument.SplitDocument(inputFilePath, splitIndex, outputFilePaths.ToArray());
C#: quick to break, divide pdf document into multiple pdf files
The following steps and C# example source code will show how to split PDF pages to multiple (3) PDF files using C# code.
The following C# example code will split and divide a PDF file into 3 new PDF files.
- File 0: contains the first page and second page of the source PDF file
- File 1: contains the third page of the source PDF file
- File 2: contains all remained pages
- Define a Integer array (pageIndexes) to hold the new splitted PDF files page index
- Create e a String array to contain the new PDF file paths
- Call PDFDocument.SplitDocument() to split the PDF pages into two new PDF files
#region quick to split pdf document into multiple pdf files
internal static void splitPdfFile()
{
String inputFilePath = @"C:\source.pdf";
//Page indexes to devide pdf document
int[] pageIndexes = new int[] { 2, 3 };
String firstFile = @"C:\part_1.pdf";
String secondFile = @"C:\part_2.pdf";
String thirdFile = @"C:\part_3.pdf";
//Split input file to 3 files.
//File 0: page 0 ~ 1
//File 1: page 2
//File 2: page 3 ~
String[] outputFiles = new String[] { firstFile, secondFile, thirdFile };
PDFDocument.SplitDocument(inputFilePath, pageIndexes, outputFiles);
}
#endregion
Separate PDF document advanced settings
Use XDoc.PDF SDK document splitter functions to separate one or more PDFs
into multiple PDF documents by setting the number of pages, output PDF file size, or PDF bookmarks.
C# split, divide PDF document by number of pages
The following steps and C# example source code will show how to separate PDF pages into multiple documents by simply specifying the number of pages in C# code.
- Create a new SplitOptions object. And set the property MaxPages to 8, which will limit the pages count of each new file to 8 pages.
- Create a new SplitOutputOptions object. Here you will set the new PDF files names pattern
- Call PDFDocument.SplitDocument() to split the PDF pages with options
#region Split PDF document by number of pages
internal static void splitPdfFileByPageNumber()
{
String inputFilePath = @"C:\1.pdf";
// set split option
SplitOptions options = new SplitOptions(SplitMode.ByPage);
// limit the pages of each file to 8 pages
options.MaxPages = 8;
// set output option
SplitOutputOptions outputOps = new SplitOutputOptions();
outputOps.OutputFolder = @"C:\output\";
outputOps.Mode = 2;
outputOps.Label = @"Part";
outputOps.Separator = '_';
// split a PDF file with options
PDFDocument.SplitDocument(inputFilePath, options, outputOps);
}
#endregion
C# break, split pdf file by output file size
The following steps and C# example source code will show how to separate PDF pages into multiple documents by simply specifying file size in C# code.
- Create a new SplitOptions object. And set the property MaxSize to 0.03F, which will limit the size of each file to 0.03MB
- Create a new SplitOutputOptions object. Here you will set the new PDF files names pattern
- Call PDFDocument.SplitDocument() to split the PDF pages with options
#region split pdf file by output file size
internal static void splitPdfFileBySize()
{
String inputFilePath = @"C:\1.pdf";
//set split option.
SplitOptions options = new SplitOptions(SplitMode.BySize);
//limit the size of each file to 0.03M.
options.MaxSize = 0.03F;
//set output option.
SplitOutputOptions outputOps = new SplitOutputOptions();
outputOps.OutputFolder = @"C:\output\";
outputOps.Mode = 1;
outputOps.Label = @"splitByFileSizePart";
outputOps.Separator = '_';
//split a PDF file with options.
PDFDocument.SplitDocument(inputFilePath, options, outputOps);
}
#endregion
C# separate, split pdf file by top level bookmarks
The following steps and C# example source code will show how to separate PDF pages into multiple documents by simply specifying top-level bookmarks in C# code.
- Create a new SplitOptions object with SplitMode.ByBookMark.
- Create a new SplitOutputOptions object. Here you will set the new PDF files names pattern
- Call PDFDocument.SplitDocument() to split the PDF pages with options
#region split pdf file by top level bookmarks
internal static void splitPdfFileByBookmarks()
{
String inputFilePath = @"C:\2.pdf";
// set split option
SplitOptions options = new SplitOptions(SplitMode.ByBookMark);
// set output option
SplitOutputOptions outputOps = new SplitOutputOptions();
outputOps.OutputFolder = @"C:\output\";
outputOps.Mode = 2;
outputOps.Label = @"Part";
outputOps.Separator = '_';
// split a PDF file with options
PDFDocument.SplitDocument(inputFilePath, options, outputOps);
}
#endregion