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 | 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 |
| Document Name*** | String | Source PDF Reference • Specify the name of the source PDF file • For reference and tracking purposes in extraction • Helps with processing tracking | document.pdf |
Advanced Options
The following parameters are available in the Advanced Options section and are optional:
| Parameter | Type | Description | Example |
|---|---|---|---|
| Custom Profiles | Object | Extraction Configuration • Advanced configuration object for customizing extraction behavior • Supports output formats and processing options • JSON format for flexible parameter specification • Optional for specialized requirements | {"outputDataFormat": "json", "extractMetadata": true} |
Supported Attachment 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 |
| Data | JSON, XML, HTML, CSS | Web and data files |
Output
Output Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| documents | Array | PDF4me input document reference - Reference to the original input documents processed for extraction. Null for this operation type | null |
| outputDocuments | Array | PDF4me extracted attachments collection - Array of successfully extracted attachment objects containing file data, metadata, and properties from the source PDF document | [{"fileName": "sample.txt", "barcodeText": null, "docText": null, "image": null}] |
| traceId | String | PDF4me processing trace identifier - Unique trace ID for tracking the extraction request through PDF4me's processing pipeline for debugging and audit purposes | null |
| jobId | String | PDF4me job identifier - Unique job ID for the extraction operation. Null for synchronous operations, populated for asynchronous processing | null |
| statusUrl | String | PDF4me status tracking URL - URL for checking the status of asynchronous extraction operations. Null for synchronous operations | null |
| subscriptionUsage | Object | PDF4me subscription usage data - Information about API usage and subscription consumption for the extraction operation | null |
| _metadata | Object | PDF4me operation metadata - Comprehensive metadata object containing processing information, timestamps, and operation details | {"success": true, "message": "Attachments extracted successfully"} |
| _metadata.success | Boolean | PDF4me extraction status indicator - Boolean flag indicating the success or failure of the attachment extraction process. PDF4me returns true for successful extractions and false for any errors | true |
| _metadata.message | String | PDF4me extraction status message - Human-readable status message providing details about the extraction process result. Includes success confirmation or error details for troubleshooting | Attachments extracted successfully |
| _metadata.processingTimestamp | String | PDF4me processing timestamp - ISO 8601 timestamp indicating when the extraction operation was completed by PDF4me's extraction engine | 2025-09-23T20:04:09.290Z |
| _metadata.sourceFileName | String | PDF4me source document filename - Original filename of the PDF document that was processed for attachment extraction | document.pdf |
| _metadata.operation | String | PDF4me operation type - Type of operation performed by PDF4me's API, always "extractAttachmentFromPdf" for this action | extractAttachmentFromPdf |
Extracted Attachment Object Structure
| Field | Type | Description | Example |
|---|---|---|---|
| fileName | String | PDF4me extracted file name - Original filename of the extracted attachment as it appears in the source PDF document | sample.txt |
| barcodeText | String | PDF4me barcode content - Text content extracted from any barcodes found within the attachment. Null if no barcodes are present | null |
| docText | String | PDF4me document text content - Text content extracted from the attachment file. Null if the attachment is not a text-based document | null |
| image | String | PDF4me image data - Base64 encoded image data if the attachment is an image file. Null for non-image attachments | null |
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