Merge PDF in Java

Merge, combine PDFs in C#, .NET, .NET Core or Standard

DynamicPDF makes Merging PDFs together easy. Here are some examples on the basic steps and how to specify what data is merged by using merge options.

How to Merge PDF Files

Below are the steps and sample code to merge PDF files with and without options.

Steps to Merge PDFs

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

Sample code - Java

MergeDocument document = MergeDocument.Merge("C:\\DocumentA.pdf", "C:\\DocumentB.pdf");
document.Draw("C:\\Merged Output.pdf");

If you have additional PDFs to merge, you can append them by calling the Append method.

Sample code with Append - Java

MergeDocument document =  new MergeDocument("C:\\DocumentA.pdf");
        
document.append("C:\\Append DocB.pdf", 1, 2);
document.append("C:\\Append DocC.pdf");
        
document.draw("C:\\Appended Output.pdf");

Getting Started

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?

  • 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!