Merge PDF in Java
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
- Create a
MergeDocument
object using the staticMerge
method, passing in two PDFs to be merged. - Call the
Draw
method to save the merged PDF.
Sample code - Java
MergeDocument document = MergeDocument.Merge("DocumentA.pdf", "DocumentB.pdf");
document.Draw("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("DocumentA.pdf");
document.append("Append DocB.pdf", 1, 2);
document.append("Append DocC.pdf");
document.draw("Appended Output.pdf");
Getting Started
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.
- .NET - DynamicPDF Merger for .NET
- COM/ActiveX - DynamicPDF Merger for COM/ActiveX