Flatten a form
Burns the form fields into the pages, which can then no longer be edited.
No options.
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