Guide for C#
Core Document Formats
Merge or Split PDF File(s)
Additional Features

C# PDF - Merge or Split PDF File in C#.NET

C#.NET Code Demos to Combine or Divide Source PDF Document File

Visual C#
Home > .NET Imaging SDK > C# > Merge and Split Document(s)
If this is your first time to use our DocImageSDK, we strongly suggest you reading How to Start first!

C# PDF Merging & Splitting Application
This C#.NET PDF document merger & splitter control toolkit is designed to help .NET developers combine PDF document files created by different users to one PDF file and split source PDF file into different sub-documents with fast speed and high accuracy. Therefore, this C#.NET document merging and splitting control can be counted as an efficient .NET solution for keeping PDF document files well managed.
Using RasterEdge C#.NET PDF document merger & splitter control toolkit, no other external PDF-related products are required in the process of merging & splitting PDF files. And you can use this PDF document merging and splitting APIs in .NET Framework 2.0, 3.0, 3.5, 4.0 and 4.5 with Visual Studio 2005 or later versions.
In order to help you have a quicker and better understanding of this C#.NET PDF merger & splitter control SDK, we will illustrate the PDF document merging and splitting from following aspects.
  • Brief introductions on RasterEdge .NET PDF processing classes
  • C#.NET APIs and sample code to merge multiple PDF document files
  • C#.NET APIs and demo code to divide PDF document file
  • Frequently asked questions on C#.NET PDF document merger & splitter SDK
C#.NET PDF Processing Classes Overview
To help you better use these C#.NET PDF document merging & splitting APIs, we here briefly illustrate the programming classes that will be used in C#.NET PDF document page processing application.
  • PDFDocument: PDFDocument is a model that RasterEdge .NET Image SDK uses to refer to PDF document in program. Its upper class is REDocument.
  • PDFPage: Existed as an abstract concept, PDFPage class refers to the model of PDF document page that is contained in PDFDocument. Its upper class is REPage.
C#.NET PDF Merger to Combine PDF Files
Using following C#.NET PDF document merging APIs, you can easily merge two or more independent PDF files to create a larger PDF document. Besides, combined PDF document can be saved in the form of stream or the form of concrete PDF document file.

C#.NET APIs to Combine Two or More PDF Documents

void PDFDocument.Combine(List<BaseDocument> source, Stream destn);
void PDFDocument.Combine(List<BaseDocument> source, String destn);
void PDFDocument.Combine(List<String> source, Stream destn);
void PDFDocument.Combine(List<String> source, String destn);

C#.NET Sample Codes to Merge Multiple PDF Files

public void CombineDocumentsToStream(Stream s, List<BaseDocument> docList)
{
PDFDocument.Combine(docList, s);
}
public void CombineDocumentAndSaveItToFile(List<BaseDocument> docList, String destFilePath)
{
PDFDocument.Combine(docList, destFilePath);
}
C#.NET PDF Splitter to Split PDF File
In this section, we aims to tell you how to divide source PDF file into two smaller PDF documents at the page index you have just specified using RasterEdge C#.NET PDF document splitting APIs. For example, if the target PDF file has 8 pages and you input 2 as the page index using the SplitDocument method, then, the first three pages will be included in one PDF document and the rest five pages will be included in the other PDF file.

C#.NET APIs to Divide PDF File into Sub-documents

void PDFDocument.SplitDocument(Stream source, int index, List<String> destns);
void PDFDocument.SplitDocument(String source, int index, List<String> destns);
void PDFDocument.SplitDocument(Stream source, int index, List<Stream> destns);
void PDFDocument.SplitDocument(int index, String source, List<Stream> destns);

C#.NET Sample Code for PDF Document Splitting

public void splitPDFDocument(String sourceFilePath, int pageIdx, List<String> destnsPath)
{
PDFDocument.SplitDocument(sourceFilePath, pageIdx, destnsPath);
}
C#.NET PDF Merger & Splitter SDK FAQs
Q 1: Using this C#.NET PDF merger & splitter control add-on, can I insert a whole PDF file into the middle of another PDF document?
A 1: Sorry, the APIs offered by C#.NET PDF merger & splitter control add-on only allows developers to add a whole PDF file to the end of or to the beginning of another PDF document. Thus, the API that enables developers to insert a whole PDF file in the middle of another PDF document is now unavailable. But we will add this function in the next version of RasterEdge .NET PDF page processor SDK.
Q 2: The target PDF document that I need to split is password-protected. Can I use RasterEdge C#.NET PDF document merging & splitting toolkit SDK to split password-protected PDF document using Visual C# code?
A 2: Sorry, the current version of RasterEdge PDF document merging & splitting control does not support splitting password-protected PDF document in C#.NET class application.


Recommend this to Google+