Actions2
Overview
This node provides PDF manipulation capabilities with two main operations:
- Convert Images To PDF: Takes one or more images from the input binary data and converts them into a single PDF file. Each image becomes a page in the resulting PDF.
- Merge PDFs: Combines two existing PDF files from the input binary data into a single merged PDF.
These operations are useful when automating workflows that require generating PDFs from images (e.g., scanned documents, photos) or combining multiple PDF documents into one (e.g., merging reports, contracts).
Practical Examples
- Automatically convert a batch of uploaded images into a single PDF report.
- Merge two separate PDF invoices into one consolidated document for easier distribution.
Properties
| Name | Meaning |
|---|---|
| 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 file. |
| Keep Images | (Only for "Convert Images To PDF") Whether to keep the original image files in the output. |
Additional properties relevant only for the "Merge PDFs" operation (not requested but present in code):
| Name | Meaning |
|---|---|
| First PDF Binary Field | The binary field name containing the first PDF to merge. |
| Second PDF Binary Field | The binary field name containing the second PDF to merge. |
| Keep Source PDFs | Whether to keep the original source PDFs in the output after merging. |
Output
The node outputs items with updated binary data containing the generated PDF under the specified destination key.
- The
jsonoutput remains unchanged except for error handling cases. - The
binaryoutput contains the new PDF file as a binary buffer with the filename set to the provided PDF Name plus.pdf. - If "Keep Images" is false during image-to-PDF conversion, the original image binaries are removed from the output.
- For PDF merging, if "Keep Source PDFs" is false, the original PDF binaries used for merging are removed.
No other output fields or metadata are added by this node.
Dependencies
- Uses the
pdfkitlibrary to create PDFs from images. - Uses the
image-sizelibrary to determine image dimensions. - Uses the
pdf-liblibrary to load and merge existing PDF files. - Requires input items to have binary data fields containing images or PDFs.
- No external API keys or services are required; all processing is local.
Troubleshooting
Error: No binary data exists on item!
This occurs if the input item does not contain any binary data. Ensure your input has valid binary fields with images or PDFs.Error: First PDF field "X" does not exist on item! / Second PDF field "Y" does not exist on item!
Happens when the specified binary field names for PDFs to merge do not match any binary keys in the input. Verify the exact binary field names.Error merging PDFs: ...
Indicates an issue loading or merging the PDF files, possibly due to corrupted or invalid PDF content. Check the source PDFs for validity.Image size detection failure
If an image cannot be processed (e.g., unsupported format), the node may fail. Confirm input images are valid and supported formats.When using "Keep Images" or "Keep Source PDFs", ensure sufficient memory/storage as the node retains original binary data alongside the generated PDF.
Links and References
- pdfkit GitHub repository – PDF generation library used for creating PDFs from images.
- pdf-lib GitHub repository – Library used for reading and merging PDF files.
- image-size npm package – Used to get image dimensions for proper PDF page sizing.