File: Merge, Append PDF Files
Work with Other SDKs
File: Merge, Append PDF Files
Home ›› XDoc.PDF ›› C# PDF: Merge and Append PDF

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

Provide C# Demo Codes for Merging and Appending PDF Document


RasterEdge C#.NET PDF document merging toolkit (XDoc.PDF) 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 merge and append one PDF document to another PDF document file, and choose to create a new PDF file in .NET class application.

Besides C#.NET PDF document merging function, XDoc.PDF, a professional third-party .NET document imaging toolkit, also offers other advanced PDF document page processing and manipulating functions, such as PDF page insertion, PDF page deleting, PDF document splitting, PDF page reordering and PDF page image and text extraction. Remarkably, all those C#.NET PDF document page processing functions can be implemented independently, without using any Adobe-related software.

Our .NET PDF SDK empowers C# programmers to easily merge and append PDF files with mature APIs. To be more specific, two or more input PDF documents can be merged and appended together according to its loading sequence, and then saved and output as a single PDF with user-defined location.

Combine and Merge Multiple PDF Files into One Using C#

This part illustrates how to combine three PDF files into a new file in C# application. You may also combine more PDF documents together.

String inputFilePath1 = Program.RootPath + "\\" + "1.pdf";
String inputFilePath2 = Program.RootPath + "\\" + "2.pdf";
String inputFilePath3 = Program.RootPath + "\\" + "3.pdf";
String outputFilePath = Program.RootPath + "\\" + "Output.pdf";
String[] inputFilePaths = new String[3] { inputFilePath1, inputFilePath2, inputFilePath3 };

// Combine three PDF files and output.
PDFDocument.CombineDocument(inputFilePaths, outputFilePath);

Append PDF Document in C#

In addition, C# users can append a PDF file to the end of a current PDF document and combine to a single PDF file.

//  get PDFDocument object from one file
String inputFilePath1 = Program.RootPath + "\\" + "1.pdf";
PDFDocument doc1 = new PDFDocument(inputFilePath1);
//  get PDFDocument object from another file
String inputFilePath2 = Program.RootPath + "\\" + "2.pdf";
PDFDocument doc2 = new PDFDocument(inputFilePath2);

//  append the 2nd document

//  save the document
String outputFilePath = Program.RootPath + "\\" + "Output.pdf";