Merge PDF in Java

Use Aspose.Slides for Java to merge PDF files in Java applications.

Merge PDF to PDF using Aspose.Slides

Aspose.Slides for Java is a Java API for creating, editing, converting, and merging presentation content. You can place PDF files into a Presentation and import multiple PDF files and save them as one PDF file.

Merge PDF to PDF in Java

Using Aspose.Slides for Java , you can merge PDF files and create a PDF result with a few lines of Java code.

Java code for merging PDF to PDF

Presentation presentation = new Presentation();
try {
    presentation.getSlides().removeAt(0);
    presentation.getSlides().addFromPdf("document1.pdf");
    presentation.getSlides().addFromPdf("document2.pdf");

    presentation.save("merged.pdf", SaveFormat.Pdf);
} finally {
    presentation.dispose();
}

How to merge PDF files in Java

  1. Install Aspose.Slides for Java .

  2. Add the library as a reference in your project.

  3. Create a Presentation instance.

  4. Import the source PDF files with addFromPdf.

  5. Save the merged content with SaveFormat.Pdf.

Merge Files Online

Merge presentations and slides online.