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 "Extract Attachment From PDF" operation in this node allows users to extract embedded attachments from a PDF document. This is useful when you have PDFs that contain other files attached inside them (such as images, documents, or data files) and you want to retrieve those attachments for further processing or analysis.

Common scenarios include:

  • Extracting supporting documents embedded within a PDF report.
  • Retrieving images or media files attached inside a PDF.
  • Automating workflows where attachments need to be extracted and processed separately.

Practical example:

  • A user receives a PDF invoice with embedded XML data as an attachment. Using this node, they can extract the XML file automatically and pass it downstream for data extraction or validation.

Properties

Name Meaning
Input Data Type Choose how to provide the PDF file to extract attachments from. Options:
• Binary Data — Use PDF file from previous node
• Base64 String — Provide PDF content as base64 encoded string
• URL — Provide URL to PDF file
Input Binary Field Name of the binary property containing the PDF file (usually "data"). Required if Input Data Type is Binary Data.
Base64 PDF Content Base64 encoded PDF document content. Required if Input Data Type is Base64 String.
PDF URL URL to the PDF file to extract attachments from. Required if Input Data Type is URL.
Document Name Name of the document used for processing (default: "document.pdf").
Advanced Options Collection of advanced options, including:
• Custom Profiles — JSON string to adjust custom properties for API calls, e.g., { 'outputDataFormat': 'json' }. Useful for fine-tuning extraction behavior.

Output

The node outputs JSON data representing the extracted attachments from the PDF. Each extracted attachment typically includes metadata such as filename, MIME type, and the actual content (likely as binary data or base64 encoded).

If the node supports binary output, the extracted attachments will be available as binary data fields, allowing subsequent nodes to process or save these files.

Dependencies

  • Requires access to the PDF4me API service for PDF processing.
  • An API key credential or equivalent authentication token must be configured in n8n to authorize requests to the PDF4me service.
  • Internet connectivity is required if providing the PDF via URL or when calling the external API.

Troubleshooting

  • Common issues:

    • Providing incorrect input data type or missing required fields (e.g., forgetting to specify the binary field name when using binary data).
    • Invalid or inaccessible PDF URL leading to download failures.
    • Malformed base64 string causing decoding errors.
    • API authentication failures due to invalid or missing credentials.
  • Error messages and resolutions:

    • "Invalid input data" — Check that the PDF file is correctly provided according to the selected input data type.
    • "Failed to fetch PDF from URL" — Verify the URL is correct, publicly accessible, and not behind authentication.
    • "API authentication error" — Ensure the API key or token is properly set up in n8n credentials.
    • "No attachments found" — The PDF may not contain any embedded attachments; verify the source PDF.

Links and References

Discussion