Combine PDF documents (.NET Core/Framework)

In the following example, you combine three PDF documents into a single PDF.

Watch the Video

How to Combine PDF documents

Download the NuGet package and Github project to get started. The following steps illustrate combining multiple PDF documents into a single PDF.

Steps for Combining PDF Documents

  1. Create a MergeDocument object by passing the first PDF file to the constructor.
  2. Call the Append method with the second PDF document.
  3. Call the Append method a third time to append another PDF document. Also pass the 1, and 2 page parameters to the Append method.
  4. Call the Draw method to save the merged PDF.

The Append method has several overloaded methods, including specifying the start page and page count properties. For example, the Append method below appends two pages of the document DocumentC.pdf, beginning with page one. For more information on the options available to you using Append, refer to the MergeDoccument.Append documentation.

Sample Code - C#

MergeDocument document = new MergeDocument("DocumentA.pdf");
document.Append("DocumentC.pdf, 1, 2);

Steps for Specifying MergeOptions for a PDF Document

  1. Create a MergeOptions object by calling the static Append method.
  2. Set the MergeOptions Outlines to false.
  3. Create a new MergeDocument.
  4. Call the Append method to append a document. Also pass options to the Append method.
  5. Call the Draw method to save the merged PDF.

As mentioned above, the Append method has several overloaded methods available for you to use. In this example, you use the MergeOptions class combined with the Outlines property to specify that the PDF's outlines and bookmarks are not imported. Refer to the MergeOptions documentation for more information.

Sample Code - C#

MergeOptions options = MergeOptions.Append;
options.Outlines = false;
MergeDocument document = new MergeDocument();
document.Append("DocumentC.pdf", options);

Getting Started

NuGet Package

Download DynamicPDF Merger NuGet ceTe.DynamicPDF.CoreSuite.NET package. The Core Suite includes Generator, Merger and ReportWriter.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

GitHub Example Project

Clone or view the example project at GitHub. This example is is the Examples/CombinePDFs.cs file.

Clone or View Example Project on GitHub

DynamicPDF Merger Information

More information on DynamicPDF Merger can be found here:

Java and Com/ActiveX Platforms

The DynamicPDF Merger is also available for Java and COM/ActiveX. Refer to the respective product pages for more details.

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 18 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!