PDF4me icon

PDF4me

Comprehensive PDF and document processing: generate barcodes, convert files, extract data, manipulate images, and automate workflows with the PDF4ME API

Actions80

Overview

The "Add Attachment To PDF" operation allows users to add one or multiple file attachments to an existing PDF document. This node is useful in scenarios where you want to enrich a PDF with supplementary files such as text documents, images, spreadsheets, or any other relevant files that should be bundled together for distribution or archival purposes.

Practical examples include:

  • Attaching supporting documentation (e.g., contracts, receipts) to a main PDF report.
  • Bundling related files with a PDF invoice before sending it to clients.
  • Adding reference materials or multimedia files to a PDF presentation.

The node supports multiple ways to provide the source PDF and the attachments, including binary data from previous nodes, base64 encoded strings, or URLs pointing to the files.

Properties

Name Meaning
Input Data Type How to provide the source PDF file. Options:
• Binary Data — Use PDF file from previous node.
• Base64 String — Provide PDF content as a base64 encoded string.
• URL — Provide URL to PDF file.
Input Binary Field Name of the binary property containing the PDF file when using Binary Data input type (usually "data").
Base64 PDF Content Base64 encoded content of the PDF document when using Base64 String input type.
PDF URL URL to the PDF file when using URL input type.
Output File Name Desired filename for the output PDF file with attachments (e.g., "document_with_attachments.pdf").
Document Name Name of the source PDF file for reference purposes (e.g., "original-file.pdf").
Attachments Collection of files to attach to the PDF. Each attachment includes:
• Attachment Content Type: How to provide the attachment content (Binary Data, Base64 String, or URL).
• Attachment Name: Filename with extension.
• Base64 Content: Base64 encoded attachment content.
• Binary Field Name: Binary property name containing the attachment file.
• File URL: URL to the attachment file.
Advanced Options Optional JSON profiles to customize API call properties for advanced use cases.
Debug Options Enable debug mode with options for log level (Basic or Detailed) and whether to output logs to console.
Binary Data Output Name Custom name for the binary data field in the node's output (default is "data").

Output

The node outputs the modified PDF document with the added attachments as binary data. The output contains:

  • A JSON object representing the item metadata.
  • A binary property (default named "data" or custom named by user) containing the PDF file with attachments.

This binary data can be used downstream in workflows for saving to disk, sending via email, or further processing.

Dependencies

  • Requires access to the PDF4me API service to perform the attachment addition operation.
  • Needs appropriate API authentication credentials configured in n8n to authorize requests.
  • Internet access is required if providing PDFs or attachments via URLs.

Troubleshooting

  • Common Issues:

    • Incorrect binary property names may cause the node to fail to locate the input PDF or attachments.
    • Invalid base64 strings or malformed URLs will result in errors during file retrieval or decoding.
    • Missing or invalid API credentials will prevent successful communication with the PDF4me service.
  • Error Messages:

    • Errors indicating "file not found" or "invalid input" usually mean the input PDF or attachment was not correctly provided.
    • Authentication errors suggest misconfigured or missing API keys.
    • Network errors may occur if URLs are inaccessible or internet connectivity is interrupted.
  • Resolutions:

    • Verify binary property names match those from previous nodes.
    • Ensure base64 strings are properly encoded without extra characters.
    • Confirm URLs are reachable and publicly accessible.
    • Check API credentials and permissions in n8n settings.
    • Enable debug mode to get detailed logs for troubleshooting.

Links and References

Discussion