Apache PDFBox - Merge PDFs
π§ Operation Name
Apache PDFBox - Merge PDFs
mergePdfs
π§Ύ Description
Combines two or more PDF documents into a single unified PDF. Each input file is processed in-memory using PDFBox's random-access buffering to ensure full compatibility with PDFBox 3.0.x.
Ideal for combining related documents before delivery, archiving, or downstream transformation.
β
Inputs
PDF Files [List of Binary] (
List<InputStream>) A list of PDF streams to merge. Must contain at least two. Provided via a DataWeave expression or flow variable (e.g.,#[payload],#[vars.myList]).
π€ Output
Payload:
InputStream(binary stream) A single merged PDF containing all input documents, in the order provided.Attributes:
PdfBoxFileAttributesMetadata from the merged output which will be from the FIRST pdf except total page count will be the combined page total of merged pdf: total page count, file size, title, author, etc.
π§ͺ MuleSoft Flow Example
Hereβs how to call this operation in a MuleSoft flow:
π Notes
Input must contain at least two PDF files, or the operation will throw an error.
The merge order follows the order of the
List<InputStream>provided β be careful with how your list is constructed.All documents are merged in memory using
RandomAccessReadBuffer, compatible with PDFBox 3.0.4.If input streams are empty (0 bytes), they will still be processed unless you add a pre-filter.
Ideal for combining invoices, attachments, or generating consolidated output PDFs
Underlying Application Interface:
Last updated


