package com.example;
import org.apache.pdfbox.io.MemoryUsageSetting;
import org.apache.pdfbox.multipdf.PDFMergerUtility;
import org.apache.pdfbox.pdmodel.PDDocument;
import java.io.File;
import java.io.IOException;
public class PDFBoxExample {
public static void main(String[] args) throws IOException {
try (PDDocument pdDocument = new PDDocument()) {
PDFMergerUtility merger = new PDFMergerUtility();
merger.addSource(new File("blank1.pdf"));
merger.addSource(new File("blank2.pdf"));
merger.setDestinationFileName("merged.pdf");
merger.mergeDocuments(MemoryUsageSetting.setupTempFileOnly());
}
}
}