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 that form fields, annotations, layers, digital signatures, and interactive elements become permanent parts of the document, preventing further editing or interaction.

Common scenarios include:

  • Preparing PDFs for archival where no further changes should be possible.
  • Ensuring consistent appearance across different PDF viewers by merging layers and flattening annotations.
  • Securing documents by converting digital signatures and interactive elements into static visuals.

Practical example: You receive a PDF with editable form fields and comments. Using this node's flatten operation, you convert all these elements into fixed text and marks so recipients cannot modify them.

Properties

Name Meaning
Input Data Type Choose how to provide the PDF file to flatten:
- Binary Data: Use PDF file from previous node
- Base64 String: Provide PDF content as base64 encoded string
- URL: Provide URL 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 PDF document content (used if Input Data Type is Base64 String)
PDF URL URL to the PDF file to flatten (used if Input Data Type is URL)
Output File Name Name for the output flattened PDF file (e.g., "flattened_document.pdf")
Document Name Name of the source PDF file for reference (e.g., "document.pdf")
Flattening Options Collection of boolean options to control 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 digital signatures to visual representation only
- Flatten Interactive Elements: Convert buttons, links, and other interactive elements to static content
Advanced Options Custom profiles in JSON format to adjust extra properties for API calls (e.g., output data format). Reference: https://developer.pdf4me.com/api/profiles/index.html
Binary Data Output Name Custom name for the binary data in the node output (default: "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 elements flattened according to the chosen options.

The json output field typically includes metadata about the processed file, such as the filename and possibly status information.

If the input was provided as binary data, base64 string, or URL, the output will be a binary PDF file ready for further use or download.

Dependencies

  • Requires an external PDF processing service accessible via API to perform the flattening operation.
  • Needs an API key credential configured in n8n to authenticate requests to the PDF processing service.
  • Network access to fetch PDF files if using URL input type.

Troubleshooting

  • Common issues:

    • Invalid or inaccessible PDF URL: Ensure the URL is reachable and points to a valid PDF file.
    • Incorrect binary property name: Verify the binary field name matches the input data.
    • Malformed base64 content: Confirm the base64 string is correctly encoded without extra characters.
    • API authentication errors: Check that the API key credential is properly set up and has necessary permissions.
    • Large PDF files may cause timeouts or memory issues depending on service limits.
  • Error messages:

    • "Invalid PDF file": Input file might be corrupted or not a PDF.
    • "Authentication failed": API key missing or invalid.
    • "Timeout": Service did not respond in time; try reducing file size or check network connectivity.
    • "Flattening option not supported": Review the flattening options and ensure they are compatible with the service.

Resolving these usually involves verifying inputs, credentials, and network conditions.

Links and References

Discussion