Merge PDF Documents in C#.NET

Easily Merge Multiple PDF Documents into One with C# Programming
For users who want to combine two or more PDF documents into a single PDF document in C#.NET applications, this C# PDF Processing Control can be used. You can easily merge various separate PDF documents into a new one by using this C# PDF Processing Control without having to resort to any slow and user-unfriendly third party tool. The free trial version of this Control is provided online and you can download it at any time without charge.
This C# PDF Document Merging SDK is a simple and standard utility program that lets you combine two or more PDF files into one. We kindly provide instructions for merging multiple PDF files into a larger one and you may refer to it when necessary.
Requirements for Merging PDF Documents in C#.NET
In some cases, as you may have the demand for merging some PDF documents into a single one, you can choose to use our PDF Merging Library for C#.NET. However, please note that .NET development requirements below are completely met.
  • .NET Framework - .NET Framework 2.0 and later versions
  • Visual Studio - Microsoft Visual Studio 2005/2008/2010
  • Operating System - Windows XP, Windows 7, Windows Server 2000, etc
Merge PDF Documents in C# Programming
This part talks about how to finish merging PDF documents into a new one with C# sample code. When conducting PDF documents merging, users need to use our C#.NET PDF Document Merging Control, with which users are able to add a PDF document to the beginning, middle or end of another PDF document so as to create a new PDF file.
  • Download and unzip the evaluation version of C#.NET PDF Documents Merging SDK.
  • Create a new C# project in your Visual Studio.
  • Activate YiiGo .NET Imaging SDK License and copy the generated txt file to the project folder you have created newly.
  • Find the following dlls under bin folder of the unzipped package and add them to your C# project reference: " YiiGo.Imaging.Basic.dll " and " YiiGo.Imaging.PDF.dll ".
  • Use the following C# sample code to merge your PDF files.
  • Run your project to see the result.
     using YiiGo.Imaging.Basic;
using YiiGo.Imaging.Basic.Core;
using YiiGo.Imaging.Basic.Codec;
using YiiGo.Imaging.PDF;

namespace YG__Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

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";

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

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

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

YGFile.SaveDocumentFile((YGDocument)docMerged, fileNameMerged, new PDFEncoder());//save new pdf

}

}
}
Other C# PDF Processing Guides
Our C# PDF Processing SDK has many useful functions, including PDF documents merging and the following functions. Whenever you have a demand, you can browse related PDF processing guides on our website.
Extract Text from PDF Document in C#.NET - It is easy to extract text from PDF files by using our C# PDF Text Extraction Library. This PDF Text Extraction Library is completely built in Visual C# and compatible with all .NET developing platforms. Developers can easily extract text from certain PDF page or certain PDF area with the C# demo code.
Split PDF Documents in C#.NET - There is a time-saving solution for PDF document splitting stated in detail and you can find it on our website. It has stated a simple way to split PDF document into smaller PDF files in C#.NET applications. You are able to download the PDF Splitting Library for C#.NET Evaluation free of charge. It is absolutely an effortless PDF tool that enables you to split PDF documents in C# class.
Print PDF Documents in C#.NET - Printing PDF documents is an easy job with the PDF Printing Control and C# sample code. And no any third party component is required as this C# PDF Printing Control is an advanced standalone component. It allows you to print a whole PDF document or certain page of the PDF document in C# class while preserving the completeness and accuracy of the original PDF document.
Products
Other Plugins
Image Viewer CoreBarcode PluginPDF Read & WriteTesseract OCR PluginForm Processing PluginJBIG2 CodecJPEG2000 CodecISIS ScannerTwain ScannerDICOM ReaderCAD Scanner