Examples

Combine PDF documents

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

Watch the Video

How to Combine PDF Documents

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("DocumentB.pdf);
document.Append("DocumentC.pdf, 1, 2);
document.Draw("Output.pdf");

Steps for Specifying MergeOptions for 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);
document.Draw("Output.pdf");

GitHub Project

Clone or view the example project at GitHub. The example code is in the Examples/CombinePDFs.cs file.

Clone or View Example Project on GitHub

Getting Started

NuGet Package

The easiest way to install the DynamicPDF Core Suite NuGet package is by installing it directly using the Visual Studio Package Manager. But the DynamicPDF Core Suite NuGet ceTe.DynamicPDF.CoreSuite.NET package is also available directly from NuGet.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

DynamicPDF Core Suite Information

More information on DynamicPDF Core Suite can be found at the DynamicPDF Core Suite webpage.

  • [DynamicPDF Core Suite for .NET](https://www.dynamicpdf.com/docs/dotnet/dynamic-pdf-core-suite-welcome"Merge, Combine, Join Split PDFs programmatically")

Available on Other Platforms

The DynamicPDF Core Suite 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 22 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

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