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

This node operation "Add Attachment To PDF" allows users to add one or multiple file attachments to an existing PDF document. It supports various ways to provide the source PDF (binary data, base64 string, or URL) and also supports different methods for supplying the attachment files themselves. This functionality is useful in scenarios where you want to enrich a PDF with supplementary documents, images, or other files embedded as attachments.

Practical examples include:

  • Adding supporting documents or references directly inside a PDF report.
  • Embedding related images or text files into a PDF invoice or contract.
  • Attaching user manuals or additional resources to a product datasheet PDF.

Properties

Name Meaning
Input Data Type How the source PDF file is provided. Options: Binary Data (from previous node), Base64 String (encoded content), or URL (link to PDF).
Input Binary Field The binary property name containing the PDF file when using Binary Data input type (usually "data").
Base64 PDF Content Base64 encoded string of the PDF document content when using Base64 input type.
PDF URL URL pointing to the PDF file when using URL input type.
Output File Name Desired filename for the output PDF with attachments (e.g., "document_with_attachments.pdf").
Document Name Reference name for the source PDF file (informational).
Attachments Collection of files to attach to the PDF. Each attachment can be provided as Binary Data, Base64 String, or URL, along with its filename and content details.
Advanced Options Optional JSON profiles to customize API call properties for advanced use cases.
Debug Options Settings to enable debug mode, select log detail level, and choose whether to output logs to console for troubleshooting purposes.
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 includes:

  • A JSON object representing the processed item.
  • A binary property containing the updated PDF file data, named according to the "Binary Data Output Name" property (default "data").

If enabled, debug information may also be included in the output depending on debug settings.

Dependencies

  • Requires access to the PDF processing API service that handles adding attachments to PDFs.
  • Needs appropriate API authentication credentials configured in n8n to authorize requests.
  • Internet access if URLs are used for input PDF or attachments.

Troubleshooting

  • Common issues:

    • Incorrect binary property names leading to missing input files.
    • Invalid or inaccessible URLs causing download failures.
    • Malformed base64 strings resulting in decoding errors.
    • Missing or invalid API credentials causing authorization errors.
  • Error messages and resolutions:

    • "File not found in binary property" — Verify the binary field name matches the actual input data.
    • "Failed to fetch file from URL" — Check URL accessibility and correctness.
    • "Invalid base64 content" — Ensure the base64 string is properly encoded without extra characters.
    • "Authentication failed" — Confirm API key or token is correctly set up in n8n credentials.
    • Enable debug mode to get detailed logs for diagnosing issues.

Links and References

Discussion