Overview
This node provides PDF manipulation capabilities within n8n workflows. It supports three main operations:
- Convert Images To PDF: Takes one or more images from the input binary data and converts them into a single PDF file, with each image on its own page.
- Merge PDFs: Combines two existing PDF files from the input binary data into a single merged PDF.
- Convert Excel To PDF: Converts an Excel worksheet into a PDF document, rendering the sheet's content as a table.
These operations are useful for automating document generation and processing tasks such as creating reports, archiving images as PDFs, merging multiple PDF documents, or converting spreadsheet data into a portable format.
Practical Examples
- Automatically convert uploaded product images into a catalog PDF.
- Merge multiple contract PDFs into a single file before sending.
- Convert sales data spreadsheets into PDF reports for distribution.
Properties
| Name | Meaning |
|---|---|
| Operation | The action to perform: Convert Images To PDF, Merge PDFs, or Convert Excel To PDF. |
| Destination Key | The name of the binary key where the resulting PDF will be stored in the output item. |
| PDF Name | The filename to assign to the generated PDF (without extension). |
| Keep Images | (Only for "Convert Images To PDF") Whether to keep the original images in the output binary data. |
| First PDF Binary Field | (Only for "Merge PDFs") The binary field name containing the first PDF to merge. |
| Second PDF Binary Field | (Only for "Merge PDFs") The binary field name containing the second PDF to merge. |
| Keep Source PDFs | (Only for "Merge PDFs") Whether to keep the source PDFs in the output binary data. |
| Excel Binary Field | (Only for "Convert Excel To PDF") The binary field name containing the Excel file to convert. |
| Include Headers | (Only for "Convert Excel To PDF") Whether to include column headers in the PDF output. |
| Sheet Name/Index | (Only for "Convert Excel To PDF") The sheet name or 1-based index of the worksheet to convert. |
| Keep Excel | (Only for "Convert Excel To PDF") Whether to keep the original Excel file in the output binary data. |
Output
The node outputs items with a binary property containing the generated PDF file under the specified destination key. The PDF is stored as binary data with the filename set to the provided PDF Name plus .pdf extension and MIME type application/pdf.
If the operation involves images or Excel conversion, the original source binary data may be removed unless the corresponding "Keep" option is enabled.
Dependencies
- Uses the following external libraries bundled with the node:
pdfkitfor PDF creation and drawing.image-sizeto determine dimensions of images.pdf-libfor loading and merging existing PDFs.exceljsfor reading Excel files.
- Requires input items to contain binary data fields with valid image, PDF, or Excel files depending on the operation.
- No additional external API keys or credentials are required.
Troubleshooting
No binary data exists on item!
This error occurs if the input item does not contain any binary data. Ensure that the previous node provides binary files.Binary field does not exist on item!
For merge and Excel conversion operations, the specified binary field names must exactly match those present in the input item. Check spelling and case sensitivity.Error merging PDFs / Error converting Excel to PDF
These errors indicate corrupted or invalid input files. Verify that the source PDFs or Excel files are valid and not damaged.Worksheet not found or invalid sheet index
When converting Excel to PDF, ensure the sheet name or index corresponds to an existing worksheet in the Excel file.Empty worksheet
If the selected Excel sheet has no data, the node will throw an error. Confirm the sheet contains data.