Design
PDF templates
Use a fillable PDF (AcroForm) directly as a Carbone template, and fill its text fields, checkboxes, and radio buttons from your JSON data.
ENTERPRISE FEATURE
Available for:
Carbone Cloud
Carbone On-premise
Embedded Carbone JS
v5.0+ NEW
Carbone can use an existing fillable PDF, an AcroForm such as an official government form, an HR document, or a form built in Adobe Acrobat, directly as a template. Upload the PDF as-is: Carbone reads its form fields and fills them with your JSON data. The template stays a PDF: there is no conversion step. See the government form filled from JSON example.
Write the tags in one of three ways, depending on what you can change in the form: in the fields, over the fields, or anywhere in the PDF with the name of each field.
This is a low-level feature to update existing PDF forms. If you want to design a new form from scratch, with clickable checkboxes and editable text fields, see Forms: that page covers the ODT-based workflow, which is the fastest way to build a form and export it to PDF. This page is about reusing a PDF form that already exists.
Prerequisites
- A PDF that already contains form fields (text fields, checkboxes, radio buttons), created or edited in a tool such as Adobe Acrobat, PDFescape or LibreOffice Draw.
- A tool to write the tags in the PDF:
- Adobe Acrobat, for all three methods.
- Firefox (built-in PDF viewer), for all three methods. Type a tag in a field, or add a text box with the Text tool. Then click Save.
- Google Chrome (built-in PDF viewer), to write tags in the fields only. Type a tag in a field, then click Download > With your changes.
Write tags in the fields
Use it when you can edit the form fields, for example on a form you own.
Type a tag as the value of a text field, like {d.company}. Carbone replaces the tag with the value from the data. The field stays editable in the report. Loops work in a text field, so one field can repeat content for each item of an array.
{
"company": "Bluebird Logistics",
"taxId": "12-3456789",
"contact": "Emma Johnson",
"email": "emma.johnson@bluebird.example",
"address": "350 Fifth Avenue, Suite 4100, New York, NY 10118"
}

Checkboxes and radio buttons have no text value, so this method fills text fields only. To fill them in the same template, place tags over the fields or target them by name.
Place tags over the fields
Use it when the form must stay untouched, for example an official or third-party form.
Add a text box comment over each field, then type a tag that ends with one of these formatters. In Acrobat, use the Add text box tool, which creates a FreeText annotation. Carbone updates the field behind the text box and removes the text box from the report.
| Formatter | Description |
|---|---|
:fill |
Fills the text field behind the tag. |
:check |
Checks the checkbox or radio button behind the tag when the condition is true. Otherwise, unchecks a checkbox. |
:uncheck |
Unchecks the checkbox behind the tag when the condition is true. Otherwise, checks it. |
{
"company": "Bluebird Logistics",
"taxId": "12-3456789",
"contact": "Emma Johnson",
"email": "emma.johnson@bluebird.example",
"address": "350 Fifth Avenue, Suite 4100, New York, NY 10118",
"paymentTerms": "net60",
"termsAccepted": true,
"newsletter": false
}

Each radio button gets its own text box and condition. {d.paymentTerms:ifEQ('net60'):check} selects Net 60 days. The newsletter checkbox is checked in the template. newsletter is false, so Carbone unchecks it.
The text box must overlap its field. If it overlaps several fields, Carbone updates the one it covers most. If it overlaps none, Carbone returns an error.
Target fields by name
Use it when the tags cannot sit on the fields, for radio groups, or for forms with many fields.
Write the tags in a text box comment anywhere in the PDF. A sticky note works too. Target each field by its name. In Acrobat, Prepare a form shows the field names. Carbone fills the fields and removes the text box from the report.
| Formatter | Description |
|---|---|
:fillField('fieldName') |
Fills the text field named fieldName. On a radio group, selects the option whose name is the value. On a checkbox, any non-empty value checks it. |
:checkField('fieldName') |
Checks the checkbox named fieldName when the condition is true. Otherwise, unchecks it. |
{
"company": "Bluebird Logistics",
"taxId": "12-3456789",
"contact": "Emma Johnson",
"email": "emma.johnson@bluebird.example",
"address": "350 Fifth Avenue, Suite 4100, New York, NY 10118",
"paymentTerms": "net60",
"termsAccepted": true,
"newsletter": false
}

To select a radio button, pass the name of the radio group to :fillField() and use the name of the option as the value, like net60. In Acrobat, the option name is the Radio Button Choice of the button. If the data holds another value, map it to an option name with conditions. For example, with "paymentDays": 60:
{d.paymentDays:ifEQ(30):show(net30):ifEQ(60):show(net60):fillField('paymentTerms')}
If the radio group has no option with the resulting name, like net30 or net60 above, Carbone returns an error.
Known limitations
- In Carbone Studio, the embedded PDF viewer cannot display filled forms. Uncheck "Use embedded PDF viewer" in the preview panel to see the actual result.
- Buttons and other unsupported field types are silently ignored rather than raising an error.
- The native macOS Preview app can break PDF forms that contain radio buttons. Test the generated document with Adobe Acrobat Reader or another standards-compliant viewer.
Automate a PDF form
To fill a PDF form with the Carbone API:
- Prepare two files: a fillable PDF template with Carbone tags, written with one of the three methods above, and the JSON data to fill it.
- Send a
POST /render/templaterequest to the Carbone API, withoutconvertTo. The template is already a PDF, so Carbone fills the tags and returns the same file without converting it. For example, with curl:
curl --location --request POST 'https://api.carbone.io/render/template?download=true' \
--header 'carbone-version: 5' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer API_TOKEN' \
--data-raw "{
\"data\": $(cat form-fields-data.json),
\"template\": \"$(base64 -i form-fields-template.pdf)\"
}" \
--output result.pdf
💡 Linux users: replacebase64 -i form-fields-template.pdfwithbase64 -w 0 form-fields-template.pdf
Key parameters
| Parameter | Description |
|---|---|
template |
Your fillable PDF, encoded as a Base64 string. |
data |
JSON data used to fill the form fields. |
?download=true |
Query parameter to download the document as a stream. |
Authorization |
Header required for the Carbone Cloud API. Get your API key here. |
For more details, refer to the Carbone API Documentation.