Examples

Merging PDFs

Easily merge multiple PDF documents when using DynamicPDF Core Suite for .NET. Refine the output from merging by specifying merge options. The following C# examples show you how.

Watch the Video

How to Merge PDF

The following steps and C# example code illustrates merging PDF documents and adding options when merging a document.


Steps for Merging a PDF Document


  1. Create a MergeDocument object using the static Merge method, passing the two PDFs to be merged.
  2. Add the Draw method to save the merged PDF.

Sample Code - C#


MergeDocument document = MergeDocument.Merge("DocumentA.pdf", "DocumentB.pdf");
document.Draw("output.pdf");

Steps to Append PDF


Append multiple PDFs by calling the Append method. The following steps and C# sample code illustrates.


  1. Create a MergeDocument object and pass the first document to the constructor.
  2. Add the MergeDocument instance's Append method and pass the PDF to be merged. Repeat for all documents requiring merging.
  3. Add the Document instance's Draw method to save the appended document.

Sample Code - C#


MergeDocument document = new MergeDocument("DocumentA.pdf");
document.Append("DocumentB.pdf");
document.Append("DocumentC.pdf");
document.Draw("output.pdf");

Steps for Specifying MergeOptions


You can specify different options while appending a document using the MergeOptions class, the following sample code illustrates.


  1. Create a MergeDocument object and pass the first document to its constructor.
  2. Create a MergeOptions object by calling the Append static property.
  3. Set the MergeOptions Outlines method to false.
  4. Pass the MergeOptions object to the Append method.
  5. Add the MergeDocument Append method, passing in an additional PDF to be merged.
  6. Add the Draw method to save the appended document.

Sample Code - C#


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

GitHub Project

Examples are provided in C# and VB.NET. Clone or view the example project at GitHub. This example code above is in the following files.


Clone or View Example Project on GitHub

Getting Started

Get started easily by installing DynamicPDF Core Suite for .NET through NuGet or manually. Then, refer to the documentation for more information on using and purchasing the product.


NuGet Package


The easiest way to install DynamicPDF Core Suite is by obtaining the NuGet package using Visual Studio's Package Manager. You can also obtain the NuGet package by downloading it directly. Refer to the installation documentation for more information.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

DynamicPDF Core Suite Information


DynamicPDF Core Suite for .NET combines creating, merging, and visual report creation into one powerful product for creating PDF documents. It is ideal for anyone who needs to generate PDF documents or reports or work with existing PDFs in their applications. With a free Evaluation Edition to try and with flexible and royalty-free licensing options, why not start using DynamicPDF Core Suite for .NET today!



More Information on Combining PDFs

Available on Other Platforms

DynamicPDF Core Suite is also available for the Java and COM/ActiveX platforms. 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!