PdfKit

PDFKit Node

Overview

This node provides PDF manipulation capabilities with 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, each image on its own page.
  • Merge PDFs: Combines two existing PDF files from the input binary data into one 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 in workflows where you need to generate PDFs dynamically from images or spreadsheets, or combine multiple PDFs into one. For example:

  • Creating a PDF photo album from uploaded images.
  • Merging multiple report PDFs into a single document.
  • Exporting Excel reports as PDFs for sharing or archiving.

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 (without extension).
Keep Images (Only for "Convert Images To PDF") Whether to keep the original image files in the output binary data after conversion.
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 source PDFs in the output binary data 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 from the Excel sheet in the PDF.
Sheet Name/Index (Only for "Convert Excel To PDF") The name or index (1-based) of the worksheet to convert.
Keep Excel File (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 named according to the provided PDF Name property with a .pdf extension.

  • For Convert Images To PDF, the output binary contains the newly created PDF composed of the input images.
  • For Merge PDFs, the output binary contains the merged PDF combining pages from both input PDFs.
  • For Convert Excel To PDF, the output binary contains the PDF rendering of the selected Excel worksheet.

If configured to keep source files (images, PDFs, or Excel), those remain in the binary data alongside the new PDF; otherwise, they are removed.

Dependencies

  • Uses the pdfkit library to create PDFs from images and Excel data.
  • Uses pdf-lib to merge existing PDF files.
  • Uses image-size to determine dimensions of images for proper PDF page sizing.
  • Uses exceljs to read Excel files and extract worksheet data.
  • Requires input items to have binary data fields containing images, PDFs, or Excel files depending on the operation.
  • No external API keys or services 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 outputs binary files (images, PDFs, or Excel) as expected.

  • Binary field does not exist on item!
    When merging PDFs or converting Excel, the specified binary field name must exactly match a binary property on the input item. Check spelling and case sensitivity.

  • Error merging PDFs / Error converting Excel to PDF
    These errors indicate corrupted or invalid PDF or Excel files. Verify the integrity of the source files.

  • Worksheet not found / Invalid sheet index
    For Excel conversion, 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.

Links and References

Discussion