PDF File Merger for Java

Merge PDF documents in a browser without needing Adobe Acrobat or Automation - Java.

Aspose.PDF for Java Logo

Merge {{FILETYPE}} files Using Java

In order to merge {{FILETYPE}}, we’ll use Aspose.PDF for Java API which is a feature-rich, powerful, and easy-to-use concatenation API for Java platform. You can download its latest version directly from Maven and install it within your Maven-based project by adding the following configurations to the pom.xml. Our Java Library can convert a document from any supported download format to any supported save format. Aspose.PDF for Java library provides fairly universal solutions that will help you solve the tasks of converting documents. Aspose.PDF supports the largest number of popular document formats, both for loading and saving. Draw your attention that the current section describes only popular conversions. The current page provides information about converting the format to format. However, there are many combinations for converting your files. For a complete list of supported formats, see the section Supported File Formats. Check the details of Installing the Library on the Documentation pages.


    <name>Aspose Java AP</name>


<version>version of aspose-pdf API</version>

How to Merge {{FILETYPE}} files via Java

You need Aspose.PDF for Java to try the code in your environment.

<% ld-json %>

  1. Open first document.
  2. Open second document.
  3. Add pages of second document to the first.
  4. Save concatenated output file

System Requirements

Just make sure that you have the following prerequisites.

Java - example code to merge PDF files.

    // Open first document
    Document pdfDocument1 = new Document(dataDir + "Concat1.pdf");
    // Open second document
    Document pdfDocument2 = new Document(dataDir + "Concat2.pdf");

    // Add pages of second document to the first

    dataDir = dataDir + "ConcatenatePdfFiles_out.pdf";
    // Save concatenated output file