Tech Specs
How-to C#
How-to VB.NET
C# PDF: How to HTML5 Viewer & Editor PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF Viewer & Editor Work with Other SDKs Barcode Read Barcode Create OCR Twain
File: Merge, Append PDF Files
Home ›› XDoc.PDF ›› C# PDF: Merge and Append PDF

How to merge, join multiple PDF documents together using XDoc.PDF for .NET in C#, ASP.NET, Winforms, Azure

Full featured C# sample source code for merging and combining PDF files in Visual C#.NET Program. Free Online Trial Download.

Professional C#.NET PDF SDK for merging PDF file merging in Visual Studio .NET

.NET components for batch combining PDF documents in C#.NET class

Powerful library dlls for mering PDF in both C#.NET WinForms and ASP.NET WebForms

Free online C#.NET source code for combining multiple PDF pages together in .NET framework

Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint

Joining & concatenating scanned images to PDF, such as tiff, jpeg, png, gif, bmp, etc

Merge Microsoft Office Word, Excel and PowerPoint data to PDF form

Append one PDF file to the end of another and save to a single PDF file

Merge PDFs with byte array, fields

High quality .net PDF merger SDK without file size limitation

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.

C# append, join, concat one PDF file to another pdf document

Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:


       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.


       If using x86, the platform target should be x86.

        #region Append one PDF file to another pdf document
        internal static void appandPdfToAnother()
            //  get PDFDocument object from one file
            String inputFilePath1 = @"C:\1.pdf";
            PDFDocument doc1 = new PDFDocument(inputFilePath1);
            //  get PDFDocument object from another file
            String inputFilePath2 = @"C:\2.pdf";
            PDFDocument doc2 = new PDFDocument(inputFilePath2);

            //  append the 2nd document

            //  save the document
            String outputFilePath = @"C:\Output.pdf";

C# combine, concatenate multiple PDF files together

        #region combine multiple PDF files together
        internal static void combineNormalPdfFiles()
            String inputFilePath1 = @"C:\1.pdf";
            String inputFilePath2 = @"C:\2.pdf";
            String inputFilePath3 = @"C:\3.pdf";
            String outputFilePath = @"C:\Output.pdf";
            String[] inputFilePaths = new String[3] { inputFilePath1, inputFilePath2, inputFilePath3 };

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

.NET Class Namespace Required

In order to run the sample code, the following steps would be necessary.

Add necessary references:









Use corresponding namespaces;

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.PDF;

public static void CombineDocument(Stream[] strStreams, String outputFilePath)

     Combine the source PDF streams into one PDF file and save it to a new PDF file on the disk.


public static void CombineDocument(Stream[] strStreams, Stream desStream)

     Combine the source PDF streams into one PDF file and save it into a new stream.


public static void CombineDocument(String[] inputFilePaths, Stream desStream)

     Combine the source PDF files into one PDF file and save it to a new stream.


public static void CombineDocument(String[] inputFilePaths, String outputFilePath)

     Combine the source PDF streams into one PDF file and save it into a new file.