Overview
This node merges two PDF files by overlaying the pages of one PDF (referred to as the "content") on top of the pages of another PDF (referred to as the "house style"). It processes each input item, extracts the specified binary PDFs, overlays their pages page-by-page, and outputs a new merged PDF file.
Common scenarios where this node is useful include:
- Adding a company-branded template or watermark (house style) behind dynamically generated content PDFs.
- Combining a styled background PDF with content PDFs for consistent formatting.
- Creating merged documents where a fixed design layer is combined with variable content.
For example, you might have a PDF containing your corporate letterhead and branding (house style), and a separate PDF with personalized report data (content). This node overlays the report pages onto the branded template pages, producing a final merged PDF ready for distribution.
Properties
| Name | Meaning |
|---|---|
| PDF File with House Style | The name of the binary property containing the PDF that provides the house style or background. |
| PDF File with Content | The name of the binary property containing the PDF with the actual content to overlay. |
| Output File Name | The filename to assign to the merged output PDF file (default: "merged.pdf"). |
| Output Binary Property | The name of the binary property in which the merged PDF will be stored in the output item. |
Output
The node outputs items with an empty JSON object ({}) and a binary property containing the merged PDF file. The binary property name is configurable via the "Output Binary Property" input.
The binary data includes:
data: Base64-encoded merged PDF content.mimeType: Always"application/pdf".fileName: The configured output file name.fileExtension: Always"pdf".fileSize: Human-readable file size string (e.g., "15 kB").
This output can be used downstream in workflows for saving, emailing, or further processing the merged PDF.
Dependencies
- Uses the
pdf-liblibrary to load, manipulate, and merge PDF documents. - Uses the
filesizelibrary to format the output file size into a human-readable string.
No external API keys or services are required. The node operates entirely on binary PDF data provided as input.
Troubleshooting
Error: "No binary data found on item."
Occurs if the input item does not contain any binary data. Ensure the input contains binary properties with PDFs.Error:
Binary data properties "X" or "Y" not found on item.
Happens when the specified binary property names for the house style or content PDFs do not exist on the input item. Verify the property names match those set in the node parameters.Mismatched page counts or unexpected output
The node overlays pages from the content PDF onto the first page of the house style PDF. If the house style PDF has multiple pages, only the first page is used as the background for all content pages. This may cause unexpected results if the house style PDF is multi-paged.Large PDFs causing performance issues
Merging large or complex PDFs may increase memory usage and processing time.
Links and References
- pdf-lib GitHub repository – Library used for PDF manipulation.
- n8n Documentation – For general guidance on creating and using custom nodes.