Guide for C#
Core Document Formats
Additional Features

C# PDF - Merge PDF Documents in C#.NET

How to Merge & Combine PDF Document Files Using C# Class Code

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

RasterEdge C#.NET PDF document merging toolkit is designed to help .NET developers combine PDF document files created by different users to one PDF file. Thus, C#.NET PDF document merge library control can be counted as an efficient .NET doc solution for keeping PDF document files organized.
This C# .NET PDF document merging control is written in managed C# code and compatible with all .NET developing platforms, like ASP.NET web application and Windows Forms project. Using this PDF document concatenating library SDK, C# developers can easily append (add to the end), prepend (add to the beginning) or insert (add to the middle) one PDF document to another PDF document file and create a new PDF file in .NET class application.
Besides this C#.NET PDF document merging library, DocImage SDK for .NET, a professional third-party .NET imaging toolkit, also offers other advanced PDF document page processing and manipulating libraries, such as PDF page insertion library, PDF page deleting library, PDF document splitting library, PDF page reordering library and PDF page image adding library. Remarkably, all those RasterEdge C#.NET PDF document page processing libraries are standalone controls, which can be used to manipulate PDF document without using any Adobe-related software.
Now let's look at the article layout of this C#.NET PDF document merging control tutorial page.
  • Brief overview of RasterEdge C# .NET PDF document merging library control
  • Guide to start a C#.NET class application for the combination of multiple PDF files
  • C#.NET method to combine PDF document files
  • Sample C# code to merge and concatenate two different PDF document files
  • C# .NET PDF document merging FAQs
C# PDF Document Merging Features
  • Professional PDF document merging control, designed for .NET Framework 2.0 and above versions
  • Easy to merge different PDF documents and save as a new PDF file using sample C# code
  • Able to combine and insert a whole PDF file into another PDF document file using C#.NET
  • Intelligent for combine large-size PDF document files in C#.NET class application
Merge PDF Files Using C#.NET
This section aims to provide guidance for how to start a C#.NET PDF document merging application using RasterEdge PDF document combining library control.
  1. Create or open a C#.NET class application in Visual Studio 2005 or above versions;
  2. Add following C# .NET PDF document merging library dlls to your C#.NET project assemblies;
    • RasterEdge.Imaging.Basic.dll
    • RasterEdge.Imaging.PDF.dll
  3. Activate .NET Imaging SDK license and copy created "RasterEdgeLicense.txt" to your C# project bin folder;
  4. Then, you are able to merge PDF document files using the sample demo C# code we have offered in following section.
C# Method to Merge PDF Documents
RasterEdge PDF document merging component offers the most advanced and easy-to-use method to merge & combine multiple PDF document files into one PDF document in C#.NET class application.
public override BaseDocument MergeDocument(BaseDocument appendDoc);
C# Demo Code to Merge PDF Documents
Using the sample C# code below, you can add one PDF document to the end of another PDF document file and save merged document as a new PDF file.
using RasterEdge.Imaging.Basic;
using RasterEdge.Imaging.Basic.Core;
using RasterEdge.Imaging.Basic.Codec;
using RasterEdge.Imaging.PDF;

namespace RE__Test
public partial class Form1 : Form
public Form1()

public static string FolderName = "c:/";

private void button1_Click(object sender, EventArgs e)
string fileName1 = FolderName + "Sample1.pdf";
string fileName2 = FolderName + "Sample2.pdf";
string fileNameMerged = FolderName + "Merged.pdf";

REDocument doc1 = REFile.OpenDocumentFile(fileName1, new PDFDecoder());//use PDFDecoder open one pdf file

REDocument doc2 = REFile.OpenDocumentFile(fileName2, new PDFDecoder());//use PDFDecoder open another pdf file

BaseDocument docMerged = doc1.MergeDocument(doc2);//merge two pdf

REFile.SaveDocumentFile((REDocument)docMerged, fileNameMerged, new PDFEncoder());//save new pdf


C#.NET PDF Document Merging FAQs
Q: I am looking for an advanced PDF document merging library which can help me finish following task. I need to select a group of PDF pages from each of the target PDF documents and combine all those selected PDF document pages into a new PDF document file. Can RasterEdge PDF document merging library control meet my request?
A: Sorry, now our C#.NET PDF document merging library assembly can only support merging two PDF document files in following two situations. One is to add a whole PDF file to the beginning of another PDF document. The other is to place a whole PDF document behind any specified page of another PDF document file, including the last page.
See More Related Tutorials!

Recommend this to Google+