Combine PDF in C# (.NET Core)

How to Combine PDFs?

Combining PDFs together with DynamicPDF Merge is simple. Below are steps and sample code showing how to combine three PDF documents into one.

Steps to Combine PDF Files

  1. Create a MergeDocument object by passing the first PDF file.
  2. Call the Append method with the second PDF file.
  3. Repeat the call to the Append method any number of times depending on the number of PDFs you need to combine. Optionally you an also specify the pages from the PDF to be appended.
  4. Invoke the Draw method on the Document to output the combined PDF.

Sample code - C#

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


Combine PDFs by Specifying Options

Steps to Combine PDFs

  1. Create a MergeOptions object.
  2. Set the options as per your requirement. In the example, we set FormFields to false, so form fields are not appended.
  3. Pass the MergeOptions object into the Append method.

Sample code - C#

// Specify the options
MergeOptions options = MergeOptions.Append;
options.Outlines = false;

// Append a document
document.Append("doc-with-outline.pdf", options);

Getting Started

NuGet Package

DynamicPDF Merger is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET package. The Core Suite package includes Generator, Merger and ReportWriter.

Nuget Logo
NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

Example Project

An example project showing this functionality can be cloned or viewed from GitHub:

GitHub Logo
Clone or View Example Project on GitHub

DynamicPDF Merger Information

More information can be found here:

Available in Other Platforms

DynamicPDF Merger PDF Library is available for Java and COM/AxtiveX platforms. Refer to the respective product pages for more details.

Why Choose DynamicPDF?

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

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