Flatten PDF API
Convert fillable PDF forms into static, non-editable documents.
Flatten PDF API Overview
The Flatten PDF API allows you to convert interactive PDF form fields into static content as part of an automated document workflow. It is designed for scenarios where filled forms need to be finalized before being shared, stored, or printed.
Flattening a PDF ensures that form values become part of the document layout and can no longer be modified. This is commonly used after form submission to preserve the data exactly as entered and to prevent further changes to the document.
This endpoint can be used on its own or combined with other PDFGate endpoints. A typical workflow includes generating a PDF form, collecting user input, flattening the form to lock in the data, and optionally applying security or compression before distribution.
The Flatten PDF API is well suited for SaaS platforms, internal tools, and document automation systems that require consistent, repeatable form finalization without relying on manual PDF processing.
Useful Guides
Quick Start
Get started quickly with a single API call. This endpoint fits easily into your existing workflows and works with any language that can make HTTP requests, including Node.js, Python, PHP, and more. Use the examples to flatten a PDF in just a few steps.
curl -X POST "https://api.pdfgate.com/forms/flatten" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@YOUR_FILE.pdf" \
-F "jsonResponse=false" \
-F "metadata={\"author\":\"John Doe\",\"documentType\":\"Contract\"}" \
--output flattened.pdf
API Parameters
File
The PDF file you want to flatten. You must provide either this or documentId.
Document Id
The ID of a PDF that already exists in your PDFGate account. Use this instead of uploading a file again.
Json Response
If it is set to true, the API will return a JSON response instead of the PDF file.
Pre Signed Url Expires In
Expiration time (in seconds) for the generated temporary download URL.
Metadata
Custom metadata you want to attach to the document.