Skip to main content
PDFEngines.merge() combines multiple PDFs into a single file. The merged PDF order follows the alphanumeric order of the input filenames (numbers first, then alphabetical). It uses Gotenberg’s merge route, which can use PDFtk, PDFcpu, QPDF, or UNO.
import { PDFEngines, PdfFormat } from "chromiumly";

const buffer = await PDFEngines.merge({
  files: ["path/to/file_1.pdf", "path/to/file_2.pdf"],
  pdfa: PdfFormat.A_2b,
  pdfUA: true,
});
Optional pdfa and pdfUA convert the merged result to PDF/A and/or PDF/UA. See Reference — PDFEngines. You can also pass watermark and/or stamp to apply PDF-engine overlays during merge. Optional rotate ({ angle: 90 | 180 | 270; pages?: string }) runs a PDF-engine rotation pass after merge. See Rotate PDFs and Watermark and stamp.