Skip to main content

Add Margin to PDF using n8n action

PDF4me Add Margin to PDF adds custom margins to PDF documents through n8n automation workflows. Process PDFs via n8n triggers, binary data, base64 strings, or public URLs to adjust margins (top, bottom, left, right) with precise measurements in millimeters or points, content repositioning, layout optimization, and page-specific margin control. This solution is ideal for print preparation, document formatting, layout standardization, binding requirements, professional presentation, and automated margin adjustment workflows that require accurate spacing control with preserved content quality and seamless integration.

Setup

Add the PDF4me "Add Margin 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:

  1. Add PDF4me node to workflow
  2. Select "Add Margin to PDF" action
  3. Configure input parameters (see below)
Add Margin to PDF

Parameters

Complete list of parameters for the Add Margin to PDF action. Configure these parameters to control margin addition.

Important: Parameters marked with an asterisk (***) are required and must be provided for the action to function correctly.

ParameterTypeDescriptionExample
Input Data Type***StringPDF 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 FieldBinaryBinary 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 ContentStringBase64 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 URLStringPublic 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***StringEnhanced PDF Output Filename
• Specify the name for the generated PDF file
• Must include .pdf extension
• PDF4me ensures unique naming and format validation
document_with_margins.pdf
Document Name***StringSource PDF Reference
• Specify the name of the source PDF file
• For reference and tracking purposes
• Helps with processing tracking
document.pdf
Left Margin (Mm)***NumberLeft Margin in Millimeters
• Set the left margin space in millimeters
• Applied to the left side of document content
• PDF4me provides precise millimeter-based positioning
• Essential for print-ready output
20
Right Margin (Mm)***NumberRight Margin in Millimeters
• Set the right margin space in millimeters
• Applied to the right side of document content
• PDF4me ensures consistent right alignment
• Essential for content flow control
20
Top Margin (Mm)***NumberTop Margin in Millimeters
• Set the top margin space in millimeters
• Applied above the document content
• Provides accurate vertical spacing
• Essential for header space
25
Bottom Margin (Mm)***NumberBottom Margin in Millimeters
• Set the bottom margin space in millimeters
• Applied below the document content
• Ensures proper footer space
• Prevents content cutoff
25
Binary Data Output Name***StringBinary Data Output Mapping
• Define the variable name for accessing generated PDF binary data
• Used in subsequent workflow actions
• Essential for workflow automation
data

Advanced Options

The following parameters are available in the Advanced Options section and are optional:

ParameterTypeDescriptionExample
Custom ProfilesStringCustom Configuration Profiles
• Set additional options using custom profiles
• JSON-like format containing predefined parameters
• Enables advanced margin processing settings
• Optional for specialized requirements
{ "preserveContentQuality": true, "autoAdjustPageSize": true }

Output

Output Parameters

ParameterTypeDescriptionExample
fileNameStringPDF4me 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 processesdocument_with_margins.pdf
fileSizeNumberPDF4me 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 automation125430
successBooleanPDF4me margin addition status indicator - Boolean flag indicating the success or failure of the margin addition process. PDF4me returns true for successful operations and false for any errors, enabling robust error handling in automated workflowstrue
mimeTypeStringPDF4me 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 applicationsapplication/pdf
pageCountNumberPDF4me processed page count - Number of pages that were processed with margin adjustments. Provides verification of successful page processing and helps track document enhancement progress5
messageStringPDF4me margin addition status message - Human-readable status message providing details about the margin addition process result. Includes success confirmation or error details for troubleshootingMargins added to PDF successfully

N8N Action Response

The PDF4me Add Margin to PDF API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:

JSON Response Format

The raw JSON response from the API:

[
{
"success": true,
"message": "Margins added to PDF successfully",
"fileName": "document_with_margins.pdf",
"mimeType": "application/pdf",
"fileSize": 125430,
"pageCount": 5
}
]

Use Cases

  • Add margins to PDF documents for print preparation, professional formatting, and print-ready document standards
  • Process business documents, reports, and presentations by adding margins for print compatibility, professional appearance, and print quality
  • Transform marketing materials, brochures, and promotional documents by adding margins for print production, professional presentation, and marketing standards

Document Standardization and Branding

  • Add margins to PDF documents for document standardization, brand consistency, and corporate identity requirements
  • Process official documents, contracts, and legal materials by adding margins for professional presentation, legal compliance, and official documentation
  • Transform client documents, proposals, and business materials by adding margins for professional appearance, brand consistency, and client presentation

Accessibility and Usability Enhancement

  • Add margins to PDF documents for improved readability, accessibility, and user experience across different devices and viewing conditions
  • Process educational materials, training documents, and instructional content by adding margins for better readability, learning experience, and educational effectiveness
  • Transform technical documentation, user guides, and reference materials by adding margins for improved usability, navigation, and user experience

Get Help