Merge PDF icon

Merge PDF

Merges two PDF documents

Overview

This node merges two PDF documents into a single combined PDF. It takes two separate PDF inputs, each provided as binary data on separate input streams, and outputs a merged PDF file. This is useful in scenarios where you need to consolidate multiple PDF files—such as combining reports, invoices, or forms—into one document for easier distribution or archiving.

For example, if you have two sets of PDF documents representing different parts of a contract or report, this node can merge them page-by-page into a single cohesive PDF file.

Properties

Name Meaning
Property Name 1 Name of the binary property on the first input that holds the first PDF document to merge.
Property Name 2 Name of the binary property on the second input that holds the second PDF document to merge.
Property Name Out Name of the binary property where the merged PDF document will be output.

Output

The node outputs a single item per pair of input items, containing:

  • A JSON object merging the original JSON data from both inputs.
  • A binary property (named as specified by "Property Name Out") containing the merged PDF file.
  • The binary data is prepared with the filename ending in .pdf and MIME type application/pdf.
  • The output preserves pairing information from both inputs.

Dependencies

  • Requires the input binary data to be valid PDF files.
  • Uses internal helper functions to convert binary data streams to buffers and back.
  • Relies on an external utility module (PdfMergeUtils) for PDF validation and merging logic.
  • No external API keys or services are required.

Troubleshooting

  • Input length mismatch: The node expects both inputs to have the same number of items. If they differ, it throws an error indicating invalid input lengths.
  • Invalid PDF input: If either input's binary property does not contain a valid PDF file, the node throws an error specifying which input and property caused the issue.
  • Binary property missing or incorrect: Ensure the binary property names configured in the node match those present in the incoming data.
  • Continue on Fail: If enabled, the node will skip failed merges and continue processing other items, outputting unmodified data for failed pairs.

Links and References

Discussion