Skip to main content
Version: 9.x

Flatten a form

Burns the form fields into the pages, which can then no longer be edited.

POST/forms/pdf/flatten-form
filesfile[]required

The PDFs.

archivesfile[]

ZIP files Gotenberg unpacks: each entry counts as a file uploaded under files.

URLs Gotenberg downloads first, as if you had uploaded the files. Each entry takes a url, and optionally extraHttpHeaders.

No options.

The PDF, or a ZIP of the PDFs when you send several.

The route also takes the headers. An error answers a status and a message: see Errors.

curl \
--request POST http://localhost:3000/forms/pdf/flatten-form \
--form files=@form.pdf \
-o form.pdf

The values become part of the page. No reader can change them, and /forms/pdf/info answers "formFields": false.

A field that stores no appearance, as a field set-form filled, is drawn from its value: one line in the form's font, over the background and the border the field declares. A value outside Western European text, Cyrillic or Chinese for instance, is drawn with a font installed in the image, embedded in the PDF. Letters that join or reorder, as Arabic and Devanagari do, come out one by one. A value no installed font has the characters of answers 400 and names the field: install a font that does.

Fill, then flatten​

curl \
--request POST http://localhost:3000/forms/pdf/pipe \
--form files=@form.pdf \
--form 'stages=[
{ "op": "set-form", "fields": { "name": "Ada Lovelace" } },
{ "op": "flatten-form" }
]' \
-o form.pdf

In a list of stages​

The stage also runs in a list on /forms/pdf/pipe, and on the PDFs a Chromium or LibreOffice conversion makes, in its stages field:

curl \
--request POST http://localhost:3000/forms/pdf/pipe \
--form files=@form.pdf \
--form 'stages=[
{ "op": "set-form", "fields": { "name": "Ada Lovelace" } },
{ "op": "flatten-form" }
]' \
-o form.pdf