This Java program merges two PDF files into a single one using Qoppa’s PDF library jPDFProcess.
// Load the two documents PDFDocument pdfDoc1 = new PDFDocument ("input1.pdf", null); PDFDocument pdfDoc2 = new PDFDocument ("input2.pdf", null); // Append the second document to the first one pdfDoc1.appendDocument(pdfDoc2); // Save the merged document pdfDoc1.saveDocument ("output.pdf"); |
jPDFProcess is a PDF library that provides a lot of PDF functions to work with PDF documents. If you’re only merging and splitting PDF documents, our PDF library jPDFAssemble may satisfy your needs.