Overview
This node provides PDF manipulation capabilities with three main operations: converting images to a PDF, merging two PDFs into one, and converting Excel spreadsheets to PDF format. It is useful in workflows where you need to generate or combine PDF documents dynamically from various input formats.
- Convert Images To PDF: Takes multiple image files from the input binary data and compiles them into a single PDF document, each image on its own page.
- Merge PDFs: Combines two existing PDF files from the input binary data into one continuous PDF.
- Convert Excel To PDF: Converts a specified worksheet from an Excel file into a formatted PDF document, optionally including column headers.
Practical examples:
- Automatically generating a PDF photo album from uploaded images.
- Combining multiple PDF reports into a single document for easier distribution.
- Creating PDF versions of Excel reports for sharing or archiving.
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 document. |
| Keep Images | (Only for "Convert Images To PDF") Whether to retain the original image files in the output. |
| 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 original PDF files in the output after merging. |
| 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 index (1-based) to convert from the Excel file. |
| Keep Excel | (Only for "Convert Excel To PDF") Whether to keep the original Excel file in the output. |
Output
The node outputs items with a binary property containing the generated PDF file under the user-specified destination key. The PDF is stored as binary data with the filename set to the provided PDF Name plus ".pdf" extension.
- For "Convert Images To PDF", the output contains a PDF with each image on a separate page.
- For "Merge PDFs", the output contains a single PDF combining all pages from both source PDFs.
- For "Convert Excel To PDF", the output contains a PDF rendering of the selected Excel worksheet, formatted with optional headers and pagination.
If configured to keep source files (images, PDFs, or Excel), those remain in the binary data alongside the new PDF.
Dependencies
- Uses the
pdfkitlibrary to create PDFs from images and Excel data. - Uses
pdf-libto merge PDF documents. - Uses
image-sizeto determine dimensions of images. - Uses
exceljsto read Excel files and extract worksheet data. - Requires input items to contain binary data fields with appropriate file types (images, PDFs, Excel).
- No external API keys or services are required; all processing is local within the node.
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 (e.g., "First PDF field 'X' does not exist on item!")
Check that the binary field names exactly match those in the input item. Field names are case-sensitive.Error merging PDFs
Usually caused by corrupted or invalid PDF files. Verify the integrity of the source PDFs.Worksheet not found or invalid sheet index
When converting Excel to PDF, ensure the specified sheet name or index exists in the workbook.Empty worksheet
The selected Excel sheet has no data. Confirm the sheet contains rows and columns.General conversion errors
Often due to corrupted input files or unsupported formats. Validate input files before processing.
Links and References
- pdfkit GitHub - PDF generation library used for creating PDFs.
- pdf-lib GitHub - Library for PDF manipulation and merging.
- exceljs GitHub - Library for reading and writing Excel files.
- image-size npm - Utility to get image dimensions.