Compress PDF using n8n action
PDF4me Compress PDF reduces PDF file sizes while maintaining document quality through n8n automation workflows. Process PDFs via n8n triggers, binary data, base64 strings, or public URLs to compress with intelligent optimization profiles, quality preservation, image compression, font optimization, and file size reduction up to 90% while maintaining visual fidelity. This solution is ideal for storage optimization, email attachments, web delivery, bandwidth reduction, archive compression, and automated PDF optimization workflows that require efficient file size reduction with preserved quality and seamless integration.
Setup
Add the PDF4me "Compress 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 "Compress PDF" action
- Configure input parameters (see below)

Parameters
Complete list of parameters for the Compress PDF action. Configure these parameters to control PDF compression.
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 | Compressed PDF Output Filename • Specify the name for the generated compressed PDF file • Must include .pdf extension • PDF4me ensures unique naming and format validation | compress_PDF_output.pdf |
| Optimize Profile*** | String | Compression Optimization Profile • Choose the compression profile that best fits your use case • Web: balanced file size and quality for web viewing • Print: high-quality with minimal compression for printing • Screen: maximum compression for screen viewing | Web |
| Binary Data Output Name*** | String | Binary Data Mapping • Define the variable name for accessing generated compressed PDF data • Used in subsequent workflow actions • Essential for workflow data flow | data |
| Async | Boolean | Asynchronous Processing • Enable asynchronous processing for large files • When enabled, operation runs in background and returns immediately • Recommended for large PDF files | true |
Advanced Options
The following parameters are available in the Advanced Options section and are optional:
| Parameter | Type | Description | Example |
|---|---|---|---|
| Custom Profiles | String | Custom Configuration Profiles • Set additional options using custom profiles • JSON-like format containing predefined parameters • Supports outputDataFormat, preserveMetadata, compressionLevel, etc. • Optional for specialized requirements | { "outputDataFormat": "json", "preserveMetadata": true, "optimizeForPrinting": false, "compressionLevel": "medium" } |
Output
Output Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| success | Boolean | PDF4me compression status indicator - Boolean flag indicating the success or failure of the PDF compression process. PDF4me returns true for successful operations and false for any errors, enabling robust error handling in automated workflows | true |
| message | String | PDF4me compression status message - Human-readable status message providing details about the compression process result. Includes success confirmation or error details for troubleshooting | PDF compressed successfully |
| fileName | String | PDF4me generated PDF filename - The complete filename of the successfully generated compressed PDF document with proper .pdf extension. PDF4me ensures unique naming and validates file format compliance for seamless integration with downstream processes | compress_PDF_output.pdf |
| 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 |
| fileSize | Number | PDF4me PDF file size in bytes - The exact size of the generated compressed PDF file in bytes, provided by PDF4me for storage planning, bandwidth optimization, and file transfer monitoring. Essential for enterprise document management and workflow automation | 3631 |
| optimizeProfile | String | PDF4me optimization profile used - The optimization profile that was applied during compression. Confirms which profile (Web, Print, Archive, Mobile) was used for the compression process | Web |
N8N Action Response
The PDF4me Compress 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 compressed successfully",
"fileName": "compress_PDF_output.pdf",
"mimeType": "application/pdf",
"fileSize": 3631,
"optimizeProfile": "Web"
}
]
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| success | true |
| message | PDF compressed successfully |
| fileName | compress_PDF_output.pdf |
| mimeType | application/pdf |
| fileSize | 3631 |
| optimizeProfile | Web |
Schema View
The data structure and types of the response:
1 item
success: ☑ true
message: AB PDF compressed successfully
fileName: AB compress_PDF_output.pdf
mimeType: AB application/pdf
fileSize: # 3631
optimizeProfile: AB Web
Type Indicators:
AB= String#= Number☑= Boolean
Binary Data View
The actual compressed PDF file data and metadata:
data
─────────────────────────────
File Name: compress_PDF_output.pdf
File Extension: pdf
Mime Type: application/pdf
File Size: 3.5 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
Web and Digital Publishing
- Optimize PDF files for faster web loading and better user experience
- Compress large documents for email attachments and online sharing
- Reduce bandwidth usage for digital content delivery and mobile applications
Document Archiving and Storage
- Compress historical documents for long-term storage and backup systems
- Optimize PDF files for cloud storage platforms and document management systems
- Reduce storage costs while maintaining document accessibility and quality
Enterprise Document Management
- Automate PDF compression in document processing workflows
- Optimize files for different business requirements (web, print, mobile)
- Streamline document distribution and collaboration across teams