PDF4me icon

PDF4me

Comprehensive PDF and document processing: generate barcodes, convert files, extract data, manipulate images, and automate workflows with the PDF4ME API

Actions80

Overview

The node provides a "Flatten PDF" operation that processes PDF files to convert interactive and layered elements into static content. Flattening a PDF is useful when you want to ensure the document's appearance remains consistent across different viewers or prevent further editing of form fields, annotations, signatures, and other interactive components.

Common scenarios include:

  • Finalizing forms by converting fillable fields into uneditable text.
  • Making annotations and comments permanent parts of the document.
  • Merging layers to simplify the PDF structure.
  • Converting digital signatures to visual marks for archival purposes.
  • Removing interactivity such as buttons and links to produce a static document.

Practical examples:

  • A company finalizes a contract PDF by flattening it before sending it to clients to prevent changes.
  • An organization archives completed forms with all annotations and signatures flattened to preserve their state.
  • A user converts a multi-layered design PDF into a single-layer file for easier printing.

Properties

Name Meaning
Input Data Type Choose how to provide the PDF file to flatten. Options: Binary Data (from previous node), Base64 String (encoded PDF content), URL (link to PDF file).
Input Binary Field Name of the binary property containing the PDF file (used if Input Data Type is Binary Data).
Base64 PDF Content Base64 encoded string of the PDF document content (used if Input Data Type is Base64 String).
PDF URL URL pointing to the PDF file to flatten (used if Input Data Type is URL).
Output File Name Desired name for the output flattened PDF file. Default is "flattened_document.pdf".
Document Name Name of the source PDF file for reference purposes. Default is "document.pdf".
Flattening Options Collection of boolean options controlling what elements to flatten:
• Flatten Forms: Convert form fields to static text.
• Flatten Annotations: Convert annotations to permanent marks.
• Flatten Layers: Merge all layers.
• Flatten Digital Signatures: Convert signatures to visual only.
• Flatten Interactive Elements: Convert buttons, links, and other interactive elements to static content.
Advanced Options Additional customization via JSON profiles to adjust API call properties. Users can specify custom profiles following external documentation for advanced control.
Binary Data Output Name Custom name for the binary data field in the node's output. Default is "data".

Output

The node outputs the flattened PDF as binary data under the specified binary data output name (default "data"). The output contains the PDF file with all selected flattening transformations applied, ready for download, storage, or further processing in the workflow.

The json output field typically includes metadata about the processed file, but the main content is provided as binary data representing the flattened PDF document.

Dependencies

  • Requires an API key credential for the PDF processing service (a third-party PDF manipulation API).
  • The node relies on this external service to perform the flattening operation.
  • Network access is needed if providing the PDF via URL or sending requests to the API.
  • Optional advanced configuration via JSON profiles requires familiarity with the external API's profile settings (see https://developer.pdf4me.com/api/profiles/index.html).

Troubleshooting

  • Common issues:

    • Providing an invalid or inaccessible PDF URL will cause failures in fetching the document.
    • Incorrect base64 encoding or corrupted binary input may result in errors during processing.
    • Missing or invalid API authentication credentials will prevent the node from executing successfully.
    • Specifying unsupported or malformed JSON in advanced profiles can cause API errors.
  • Error messages and resolutions:

    • "Failed to fetch PDF from URL": Check the URL accessibility and correctness.
    • "Invalid PDF content": Verify the input PDF data is correctly formatted and complete.
    • "Authentication failed": Ensure the API key credential is configured properly in n8n.
    • "Profile JSON parsing error": Validate the JSON syntax and conform to the API's expected profile schema.
  • Enabling "Continue On Fail" allows workflows to proceed even if some items fail, returning error details in the output.

Links and References

Discussion