Skip to main content

Flatten PDFs

Flattens one or more PDF files by merging all interactive form fields (text inputs, checkboxes, etc.) into the page content. The resulting PDF cannot be edited.

See the PDF Engines module configuration for engine selection flags.

Basics

POST/forms/pdfengines/flatten
Headers
Gotenberg-Output-Filenamestring
The filename of the resulting file - Gotenberg automatically appends the file extension. Defaults to a random UUID filename.
Gotenberg-Tracestring
A custom request ID to identify the request in the logs; overrides the default UUID.
Form Files
filesfile[]required
PDF files to flatten.
cURL
curl \
--request POST http://localhost:3000/forms/pdfengines/flatten \
--form files=@/path/to/form.pdf \
-o my.pdf
The flattened PDF file. Multiple input files produce a ZIP archive.
Content-Disposition: attachment; filename={output-filename.ext}
Content-Type: {content-type}
Content-Length: {content-length}
Gotenberg-Trace: {trace}
Body: {output-file}

What's Next?

Brand pages with Watermark, or overlay content with Stamp.