Skip to main content

Flatten PDF using n8n action

PDF4me Flatten PDF converts interactive PDF elements into static, non-editable content through n8n automation workflows. Process PDFs via n8n triggers, binary data, base64 strings, or public URLs to flatten form fields, annotations, comments, layers, markups, and interactive elements into permanent content while preserving visual appearance, text quality, and document structure. This solution is ideal for document finalization, archival workflows, form submission processing, secure document distribution, compliance documentation, and preventing unauthorized edits that require non-editable PDF output with preserved formatting and seamless integration.

Setup

Add the PDF4me "Flatten 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 "Flatten PDF" action
  3. Configure input parameters (see below)
Flatten PDF

Parameters

Complete list of parameters for the Flatten PDF action. Configure these parameters to control PDF flattening.

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***StringFlattened PDF Output Filename
• Specify the name for the generated flattened PDF file
• Must include .pdf extension
• PDF4me ensures unique naming and format validation
flattened_document.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

Flattening Options

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

ParameterTypeDescriptionExample
Flatten FormsBooleanForm Flattening Control
• Control whether interactive form fields should be flattened
• true = converts all form fields to non-editable text
• false = preserves form field interactivity
• Useful for finalizing filled forms
true
Flatten AnnotationsBooleanAnnotation Flattening Control
• Control whether PDF annotations should be flattened
• true = merges annotations with page content
• false = preserves annotation interactivity
• Useful for comment preservation
true
Flatten LayersBooleanLayer Flattening Control
• Control whether PDF layers should be flattened into single layer
• true = combines all visible layers into one
• false = preserves layer structure
• Useful for layer consolidation
true
Flatten Digital SignaturesBooleanSignature Flattening Control
• Control whether digital signatures should be flattened
• true = converts signatures to static images
• false = preserves signature validity and interactivity
• Default is false to maintain signatures
false
Flatten Interactive ElementsBooleanInteractive Element Flattening
• Control whether all interactive elements should be flattened
• true = eliminates all interactive functionality
• false = preserves some interactive elements
• Useful for static document creation
true

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 PDF flattening settings
• Optional for specialized requirements
{ "outputDataFormat": "base64", "preserveMetadata": true }

Output

Output Parameters

ParameterTypeDescriptionExample
successBooleanPDF4me flattening status indicator - Boolean flag indicating the success or failure of the PDF flattening process. PDF4me returns true for successful flattening and false for any errors, enabling robust error handling in automated workflowstrue
messageStringPDF4me flattening status message - Human-readable status message providing details about the flattening process result. Includes success confirmation or error details for troubleshootingPDF flattening completed successfully
fileNameStringPDF4me generated flattened PDF filename - The complete filename of the successfully generated flattened PDF document with proper .pdf extension. PDF4me ensures unique naming and validates file format compliance for seamless integration with downstream processesflattened_document.pdf
mimeTypeStringPDF4me flattened PDF MIME type - The MIME type of the generated flattened PDF file, indicating the file format for proper handling in web applications and file systemsapplication/pdf
fileSizeNumberPDF4me flattened PDF file size in bytes - The exact size of the generated flattened PDF file in bytes, provided by PDF4me for storage planning, bandwidth optimization, and file transfer monitoring. Essential for enterprise document management and workflow automation24846
originalFileNameStringPDF4me source PDF reference - The original PDF filename that was processed by PDF4me's flattening engine. This reference is maintained for audit trails, debugging purposes, and tracking the source of generated flattened documents in enterprise workflowsdocument.pdf
flattenedElementsArrayPDF4me flattened elements list - Array of strings indicating which types of interactive elements were successfully flattened during the process. Shows the specific elements that were converted to static content["forms", "annotations", "layers", "digital signatures", "interactive elements"]
descriptionStringPDF4me flattening process description - Detailed description of the flattening process result, providing additional context about what was accomplished during the PDF flattening operationAll interactive elements have been converted to static content

N8N Action Response

The PDF4me Flatten 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": "PDF flattening completed successfully",
"fileName": "flattened_document.pdf",
"mimeType": "application/pdf",
"fileSize": 24846,
"originalFileName": "document.pdf",
"flattenedElements": [
"forms",
"annotations",
"layers",
"digital signatures",
"interactive elements"
],
"description": "All interactive elements have been converted to static content"
}

Use Cases

Document Security and Finalization

  • Flatten PDF documents with form fields, annotations, and interactive elements to create final, non-editable versions for distribution, archiving, and legal documentation
  • Process contracts, agreements, and legal documents by flattening them to prevent unauthorized modifications, ensure document integrity, and maintain legal validity
  • Transform editable PDF forms and templates to flattened versions for final submission, official documentation, and compliance with regulatory requirements
  • Flatten PDF documents with layers, comments, and interactive elements to prepare them for printing, physical distribution, and offline access
  • Process marketing materials, brochures, and promotional documents by flattening them to ensure consistent appearance across different devices and printing systems
  • Transform interactive PDF presentations and reports to flattened versions for formal distribution, client presentations, and stakeholder communications

Compliance and Regulatory Documentation

  • Flatten PDF documents with form data, signatures, and annotations to create final, compliant versions for regulatory submissions, audit trails, and official documentation
  • Process financial reports, compliance documents, and regulatory filings by flattening them to ensure data integrity, prevent tampering, and meet regulatory standards
  • Transform editable PDF forms and applications to flattened versions for final submission, official processing, and regulatory compliance

Get Help