Skip to main content

PDF forms

available from v1.7.0

We created two endpoints to fill in pdf forms with data /pdf_fill_packed and /pdf_fill

/pdf_fill expects a pdf template and a data file in json format while /pdf_fill_packed works with a json file (similar to docx2pdfua_packed) containing a base64 encoded template and the data in the following format:

{   
"template": { "templateBase64": "pdf-template-file-encoded" },
"data" : {
"phone number" : "12345678",
"an address" : "some address",
}
}
note

Data fields support spaces, but no nested data is allowed. Keys like "person.cpr" or "person.address" will only work if the data key actually contains a "." character and will not work if it's an object, so this is invalid:

{"person": {"address": "some address", "cpr": "123456-1234"}}.

note

Fonts: fonts used inside the PDF should be embedded in the PDF, otherwise the text will be replaced with a default font. This can lead to misalingment in the final document. To find out more read the Adobe documentation.

note

Unfortunately due to the inner structure of pdf we cannot automatically tag already existing elements, which means that screen readers will have a hard time finding a structure in the PDF templates which are not tagged initially. To solve this, we recommend that the pdf templates cleaned up and updated to the pdf 1.7 standard. If you want to know more, check out the PDF standards

If you'd like an overview of our API please check the reference API Reference.