Append Pages to PDF

Append pages to a PDF

The Java sample appends page 1 from a second PDF to the end of the first document.

Steps

  1. Create a PdfFileEditor instance.
  2. Bind the main input PDF by passing its path to append.
  3. Provide the secondary source file list and the page range to append.
  4. Save the merged result to the output file.

Java example

public static void appendPagesToPdf(Path inputFile, Path sampleFile, Path outputFile) {
    PdfFileEditor pdfEditor = new PdfFileEditor();
    pdfEditor.append(inputFile.toString(), new String[] {sampleFile.toString()}, 1, 1, outputFile.toString());
}