Add Attachment to PDF using n8n action
PDF4me Add Attachment to PDF embeds various file types directly into PDF documents through n8n automation workflows. Process PDFs via n8n triggers, binary data, base64 strings, or public URLs to attach documents, images, spreadsheets, archives, and other files with preserved file integrity, metadata handling, and multi-format support (PDF, DOC, XLS, images, ZIP, etc.). This solution is ideal for document bundling, supporting material inclusion, file archiving, contract packaging, evidence attachment, and comprehensive document packages that require reliable file embedding with seamless integration.
Setup
Add the PDF4me "Add Attachment to PDF" node to your n8n workflow and configure the required parameters. For initial setup instructions, see our n8n Integration Guide.
Prerequisites:
- PDF4me API credentials
- n8n workflow access
Configuration:
- Add PDF4me node to workflow
- Select "Add Attachment to PDF" action
- Configure input parameters (see below)

Parameters
Complete list of parameters for the Add Attachment to PDF action. Configure these parameters to control file attachment.
Important: Parameters marked with an asterisk (***) are required and must be provided for the action to function correctly.
| Parameter | Type | Description | Example |
|---|---|---|---|
| Input Data Type*** | String | PDF Input Format Selection • Choose the format of your PDF data input • PDF4me supports multiple input types • Options: Binary Data, Base64 String, or URL | Binary Data |
| Input Binary Field | Binary | Binary PDF File Input (Required if Binary Data) • Reference PDF file from previous n8n node or file upload • PDF4me processes binary PDF files with automatic format detection • Required when Input Data Type is "Binary Data" | {{ $binary.data }} |
| Base64 Document Content | String | Base64 Encoded PDF Input (Required if Base64 String) • Provide PDF data as base64 encoded string • PDF4me automatically decodes and processes the PDF content • Required when Input Data Type is "Base64 String" | UEsDBBQABgAI... |
| File URL | String | Public PDF URL Input (Required if URL) • Provide a public/open permission URL to the PDF file • PDF4me downloads and processes the file from URL • Required when Input Data Type is "URL" | https://abc.com/sample.pdf |
| Output File Name*** | String | Enhanced PDF Output Filename • Specify the name for the generated PDF file • Must include .pdf extension • PDF4me ensures unique naming and format validation | document_with_attachments.pdf |
| Document Name*** | String | Source PDF Reference • Specify the name of the source PDF file • For reference and tracking purposes • Helps with processing tracking | document.pdf |
| Attachments*** | Array | Attachment Configuration • Array of attachment objects containing file data and metadata • Each object must include fileName, fileContent, and optional description • Supports multiple file types and formats • Essential for file embedding | [{"fileName": "doc.pdf", "fileContent": "{{ $binary.doc }}"}] |
| Binary Data Output Name*** | String | Binary Data Output Mapping • Define the variable name for accessing generated PDF binary data • Used in subsequent workflow actions • Essential for workflow automation | data |
Attachment Object Structure
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
| Attachment Content Type | String | Yes | PDF4me attachment input format - Choose how the attachment file is provided (Binary Data, Base64 Content, or File URL) | Binary Data |
| Attachment Name | String | Yes | PDF4me attachment filename - Name of the file to be attached to the PDF document. Must include proper file extension for format identification | document.txt |
| Base64 Content | String | Yes (If Base64) | PDF4me base64 encoded attachment - Base64 encoded content of the attachment file. Required when Attachment Content Type is "Base64 Content" | SGVsbG8gV29ybGQ= |
| Binary Field Name | String | Yes (If Binary Data) | PDF4me binary attachment reference - Name of the binary field containing the attachment file. Required when Attachment Content Type is "Binary Data" | data |
| File URL | String | Yes (If URL) | PDF4me attachment URL - Public URL to the attachment file. Required when Attachment Content Type is "File URL" | https://example.com/files/document.txt |
Supported File Types
| Category | File Types | Description |
|---|---|---|
| Documents | PDF, DOC, DOCX, TXT, RTF, ODT | Text documents and office files |
| Images | JPG, JPEG, PNG, GIF, BMP, TIFF, SVG | Image files and graphics |
| Spreadsheets | XLS, XLSX, CSV, ODS | Data files and spreadsheets |
| Presentations | PPT, PPTX, ODP | Presentation files |
| Archives | ZIP, RAR, 7Z, TAR | Compressed file archives |
| Other | JSON, XML, HTML, CSS | Web and data files |
Output
Output Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| fileName | String | PDF4me generated PDF filename - The complete filename of the successfully generated PDF document with proper .pdf extension. PDF4me ensures unique naming and validates file format compliance for seamless integration with downstream processes | document_with_attachments.pdf |
| fileSize | Number | PDF4me PDF file size in bytes - The exact size of the generated PDF file in bytes, provided by PDF4me for storage planning, bandwidth optimization, and file transfer monitoring. Essential for enterprise document management and workflow automation | 101714 |
| success | Boolean | PDF4me attachment status indicator - Boolean flag indicating the success or failure of the PDF attachment process. PDF4me returns true for successful attachments and false for any errors, enabling robust error handling in automated workflows | true |
| mimeType | String | PDF4me output MIME type - MIME type of the generated PDF file, always "application/pdf" for PDF documents. Useful for content type validation and proper file handling in web applications | application/pdf |
| attachmentCount | Number | PDF4me attachment count - Number of attachments successfully added to the PDF document. Provides verification of successful file embedding and helps track document enhancement progress | 1 |
| message | String | PDF4me attachment status message - Human-readable status message providing details about the attachment process result. Includes success confirmation or error details for troubleshooting | PDF with attachments created successfully |
N8N Action Response
The PDF4me Add Attachment to PDF API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:
- JSON
- Table
- Schema
- Binary
JSON Response Format
The raw JSON response from the API:
[
{
"success": true,
"message": "PDF with attachments created successfully",
"fileName": "document_with_attachments.pdf",
"mimeType": "application/pdf",
"fileSize": 101714,
"attachmentCount": 1
}
]
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| success | true |
| message | PDF with attachments created successfully |
| fileName | document_with_attachments.pdf |
| mimeType | application/pdf |
| fileSize | 101714 |
| attachmentCount | 1 |
Schema View
The data structure and types of the response:
1 item
success: ☑ true
message: AB PDF with attachments created successfully
fileName: AB document_with_attachments.pdf
mimeType: AB application/pdf
fileSize: # 101714
attachmentCount: # 1
Type Indicators:
AB= String#= Number☑= Boolean
Binary Data View
The actual PDF file data and metadata:
data
─────────────────────────────
File Name: document_with_attachments.pdf
File Extension: pdf
Mime Type: application/pdf
File Size: 99.3 KB
Binary Data Access:
- n8n Binary Object:
$binary.data.data - Base64 Content: Available for direct use
- File Operations: Ready for download, email, or storage
Use Cases
Document Bundling and Information Management
- Add supporting documents, reference materials, and supplementary files as attachments to PDF documents for comprehensive information management and document bundling
- Process business proposals, project documentation, and client deliverables by adding relevant attachments for complete information delivery and stakeholder communication
- Transform legal documents, contracts, and official records by adding supporting evidence, certificates, and reference materials for complete documentation and legal compliance
Business Process and Workflow Integration
- Add supporting documents, forms, and reference materials as attachments to PDF documents for streamlined business processes and workflow integration
- Process invoices, purchase orders, and financial documents by adding supporting receipts, contracts, and approval documents for complete financial documentation
- Transform project reports, deliverables, and business communications by adding supporting data, charts, and reference materials for comprehensive project documentation
Compliance and Regulatory Documentation
- Add compliance certificates, audit reports, and regulatory documents as attachments to PDF documents for regulatory compliance and audit trail documentation
- Process quality control documents, inspection reports, and certification materials by adding supporting evidence, test results, and compliance certificates
- Transform official documents, permits, and regulatory filings by adding supporting documentation, evidence, and reference materials for complete regulatory compliance