Extract Attachment From PDF using n8n action
PDF4me Extract Attachment From PDF extracts embedded files from PDF documents through n8n automation workflows. Process PDFs via n8n triggers, binary data, base64 strings, or public URLs to automatically detect and extract attached documents, images, spreadsheets, data files, and other embedded content with preserved file integrity, metadata retention, and multi-format support (PDF, DOC, XLS, images, etc.). This solution is ideal for document analysis, file recovery, evidence extraction, attachment management, data extraction workflows, and comprehensive document processing that require reliable embedded file extraction with seamless integration.
Setup
Add the PDF4me "Extract Attachment From 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 "Extract Attachment From PDF" action
- Configure input parameters (see below)

Parameters
Complete list of parameters for the Extract Attachment From PDF action. Configure these parameters to control attachment extraction.
Important: Parameters marked with an asterisk (***) are required and must be provided for the action to function correctly.
| Parameter | Required | What it does | Example |
|---|---|---|---|
| Input Data Type | Required | Choose how to provide the PDF file to extract attachments from. Options: Binary Data, Base64 String, URL. Default is `Binary Data`. | Binary Data |
| Input Binary Field | Conditional | Name of the binary property that contains the PDF file (usually "data" for file uploads). Shown when Input Data Type is Binary Data. Default is `data`. | data |
| Base64 PDF Content | Conditional | Base64 encoded PDF document content. Shown when Input Data Type is Base64 String. | UEsDBBQABgAI... |
| PDF URL | Conditional | URL to the PDF file to extract attachments from. Shown when Input Data Type is URL. | |
| Document Name | Optional | Name of the document (used for processing). Default is `document.pdf`. | document.pdf |
| Binary Data Output Name | Optional | Custom name for the binary data in n8n output. Default is `data`. | data |
| Advanced Options | Optional | Optional settings, collapsed behind Add Option. | Add Option |
| Custom Profiles | Optional | Use 'JSON' to adjust custom properties. Review Profiles at https://dev.pdf4me.com/apiv2/documentation/ to set extra options for API calls and may be specific to certain APIs. | {"outputDataFormat": "json", "extractMetadata": true} |
Output
Output Parameters
| Field | Type | What it contains |
|---|---|---|
success | Boolean | True when the operation succeeded. |
message | String | Status message, `Attachment extracted successfully and converted to binary`. |
fileName | String | File name of the first attachment, as returned by PDF4me. |
mimeType | String | MIME type set from the attachment's extension (txt, pdf, jpg, jpeg, png, zip), `application/octet-stream` otherwise. |
fileSize | Number | Size of the first attachment in bytes. |
sourceFileName | String | Name of the input PDF: the input file's name for Binary Data, the last part of the URL for URL, and Document Name for Base64. |
processingTimestamp | String | Time the node received the result, ISO 8601. |
totalAttachments | Number | Number of attachments PDF4me found in the PDF (only the first is returned). |
data | Binary | The first attachment of the PDF. The node fails when the PDF has no attachments. |
Extracted Attachment Object Structure
| Field | Type | What it contains |
|---|---|---|
success | Boolean | True when the operation succeeded. |
message | String | Status message, `Attachment extracted successfully and converted to binary`. |
fileName | String | File name of the first attachment, as returned by PDF4me. |
mimeType | String | MIME type set from the attachment's extension (txt, pdf, jpg, jpeg, png, zip), `application/octet-stream` otherwise. |
fileSize | Number | Size of the first attachment in bytes. |
sourceFileName | String | Name of the input PDF: the input file's name for Binary Data, the last part of the URL for URL, and Document Name for Base64. |
processingTimestamp | String | Time the node received the result, ISO 8601. |
totalAttachments | Number | Number of attachments PDF4me found in the PDF (only the first is returned). |
data | Binary | The first attachment of the PDF. The node fails when the PDF has no attachments. |
N8N Action Response
The PDF4me Extract Attachment From 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:
[
{
"documents": null,
"outputDocuments": [
{
"fileName": "sample.txt",
"barcodeText": null,
"docText": null,
"image": null
}
],
"traceId": null,
"jobId": null,
"statusUrl": null,
"subscriptionUsage": null,
"_metadata": {
"success": true,
"message": "Attachments extracted successfully",
"processingTimestamp": "2025-09-23T20:04:09.290Z",
"sourceFileName": "document.pdf",
"operation": "extractAttachmentFromPdf"
}
}
]
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| documents | null |
| outputDocuments[0].fileName | sample.txt |
| outputDocuments[0].barcodeText | null |
| outputDocuments[0].docText | null |
| outputDocuments[0].image | null |
| traceId | null |
| jobId | null |
| statusUrl | null |
| subscriptionUsage | null |
| _metadata.success | true |
| _metadata.message | Attachments extracted successfully |
| _metadata.processingTimestamp | 2025-09-23T20:04:09.290Z |
| _metadata.sourceFileName | document.pdf |
| _metadata.operation | extractAttachmentFromPdf |
Schema View
The data structure and types of the response:
1 item
documents: null
outputDocuments: [
{
fileName: AB sample.txt
barcodeText: null
docText: null
image: null
}
]
traceId: null
jobId: null
statusUrl: null
subscriptionUsage: null
_metadata: {
success: ☑ true
message: AB Attachments extracted successfully
processingTimestamp: AB 2025-09-23T20:04:09.290Z
sourceFileName: AB document.pdf
operation: AB extractAttachmentFromPdf
}
Type Indicators:
AB= String#= Number☑= Boolean{}= Object[]= Array
Binary Data View
The actual attachment data and metadata:
outputDocuments
─────────────────────────────
File Count: {{ $json.outputDocuments.length }}
Success Status: {{ $json._metadata.success }}
Processing Time: {{ $json._metadata.processingTimestamp }}
Use Cases
Document Content Recovery
- Embedded File Restoration: Use the
outputDocumentsarray to recover files that were embedded within PDF documents, restoring access to original source materials - File Name Recovery: Extract original filenames from the
fileNamefield to maintain proper file identification and organization - Lost Document Recovery: Restore documents that were previously embedded in PDFs but are no longer available in their original formats
Content Processing and Analysis
- Attachment Analysis: Process individual files from the
outputDocumentscollection to analyze content, extract data, or perform specific operations on each file type - Barcode Processing: Utilize the
barcodeTextfield to extract and process barcode information from attachments for inventory, tracking, or identification purposes - Text Content Extraction: Leverage the
docTextfield to extract textual content from document attachments for search, analysis, or data processing workflows
Workflow Automation and Integration
- File Distribution: Automatically distribute extracted attachments to appropriate systems, folders, or users based on file type and content analysis
- Content Archiving: Use the
_metadata.traceIdand extraction results to maintain audit trails while organizing extracted files into structured archive systems - Multi-System Integration: Integrate extracted files with external document management systems, cloud storage platforms, or business applications