Field Types
Every field type can be written as a tag inside text, and all but the date picker as a block field node too. Every field tag follows the pattern:
[fieldType, name, ...field-specific args, width|height, interactive]
The name slot (for a radio button, its group) is the field identifier exposed to PDF readers, Word, and any downstream form-data extraction. Pick descriptive names — they show up in form-data exports.
Common slots
| Rule | |
|---|---|
| Field names | Unique, and without a period: a period separates the parts of a fully qualified field name (ISO 32000-2 12.7.4.2), so a name holding one is refused and the field is not created. A block field in a watermark or a header or footer may hold a page token, $global.PAGE, $global.NUMPAGES or $global.SECTION, which gives each page its own field (initials_$global.PAGE); in the body, and in any tag, a page token is refused. |
width|height | The control's size, both sides given, in points or with a unit (pt, in, mm, px). Left out, each tag has its own default (below); a block field defaults to 200 × 16. |
interactive | A trailing true or false. Every field is interactive: false (a flattened field) is not implemented, and asking for it is reported. |
| Quotes | A text field's, text area's or date picker's value slot may be wrapped in single quotes, so a comma inside it does not split the slot. |
| Tag | Size when width|height is left out |
|---|---|
textfield | 180 × 16 |
textarea | 180 × 48 |
checkbox, radio | 10 × 10 |
choicefield | 100 × 15 |
listbox | 120 × 100 |
datepicker | 100 × 14 |
signature | 160 × 50 |
A slot no position accepts (a stray word, yes for a boolean) is ignored and reported, so a mis-shaped slot never goes unnoticed.
Text field
A single-line text input.
[textfield, name, defaultValue, width|height]
| Slot | Description |
|---|---|
name | Unique field name |
defaultValue | Pre-filled text. Use empty string for blank, or wrap in single quotes for a value that may hold a comma |
width|height | Field dimensions in points |
{ "p": "Full Name: [textfield, fullName, John Doe, 200|20]" }
{ "p": "Email: [textfield, email, , 250|20]" }
As a block field, fieldType text is the default:
{ "field": { "label": "Company", "name": "company", "value": "Harbour Logistics Ltd", "width": 240 } }
Text area
A multi-line text input for longer content.
[textarea, name, defaultValue, width|height]
{ "p": "Additional notes:[br][textarea, notes, , 400|80]" }
{ "p": "[textarea, comments, Enter your feedback here, 350|60]" }
{ "field": { "label": "Delivery notes", "name": "deliveryNotes", "fieldType": "textArea", "width": 300, "height": 44 } }
Checkbox
A boolean toggle.
[checkbox, name, checked, width|height]
| Slot | Description |
|---|---|
name | Unique field name |
checked | Initial state: true or false |
width|height | Checkbox dimensions in points (typically square, 14–16) |
{ "p": "[checkbox, termsAccepted, false, 16|16] I accept the terms and conditions" }
Used for checklists:
{ "p": "[checkbox, item1, true, 14|14] Background check complete" }
{ "field": { "label": "Insurance included", "name": "insurance", "fieldType": "checkbox", "checked": true } }
Radio button
A selectable button within a mutually-exclusive group. radiobutton is accepted as the tag's keyword too.
[radio, value, group, selected, width|height]
| Slot | Description |
|---|---|
value | The button's export value: what the group is set to when this button is on |
group | The field name the buttons share — radios sharing a group are mutually exclusive |
selected | true or false |
width|height | Radio dimensions in points (typically square, 14) |
{ "p": "[radio, card, paymentMethod, true, 14|14] Credit Card" }
{ "p": "[radio, transfer, paymentMethod, false, 14|14] Bank Transfer" }
{ "p": "[radio, cheque, paymentMethod, false, 14|14] Cheque" }
Selecting one automatically clears the others in the same group. Export values need not be unique: two buttons of one group with the same value select independently. A group may span pages, its buttons all one field.
As block fields, the buttons share a name (the group), each carries its export value in value, and checked turns one on:
{ "field": { "label": "Monthly invoicing", "name": "invoicing", "fieldType": "radio", "value": "monthly", "checked": true } }
{ "field": { "label": "Quarterly invoicing", "name": "invoicing", "fieldType": "radio", "value": "quarterly" } }
Choice field (dropdown)
A dropdown selection from predefined options.
[choicefield, name, opt1|opt2|opt3, selectedIndex, width|height]
| Slot | Description |
|---|---|
name | Unique field name |
options | Pipe-separated option list |
selectedIndex | Zero-based index of the initially selected option. Left out, the first option is selected; an index past the list selects nothing and is reported |
width|height | Field dimensions in points |
{ "p": "Service Level: [choicefield, serviceLevel, Economy|Standard|Express|Next-Day, 1, 150|20]" }
In this example, "Standard" (index 1) is initially selected.
A block field selects by the option's text, in value, not by index. With no value, nothing is selected; a value that is not one of the options selects nothing and is reported, since a drop-down holds only an item it lists:
{ "field": { "label": "Term", "name": "term", "fieldType": "choice", "options": ["12 months", "24 months", "36 months"], "value": "24 months", "width": 140 } }
List box
A scrollable list of options, single selection only. A list box has no value slot: a value written after the options is ignored and reported.
[listbox, name, opt1|opt2|opt3, multi, width|height]
| Slot | Description |
|---|---|
name | Unique field name |
options | Pipe-separated option list |
multi | false; multiple selection is not implemented, so true is reported and a single choice is offered |
width|height | Field dimensions in points |
{ "p": "Skills: [listbox, skills, Python|Java|Go|Rust, 150|60]" }
A block list box can start with an option selected, by its text in value, under the same rule as a choice:
{ "field": { "label": "Depot", "name": "depot", "fieldType": "listBox", "options": ["Rotterdam", "Antwerp", "Hamburg"], "value": "Antwerp", "width": 140, "height": 44 } }
Date picker
A date field. In a DOCX it is a date picker control; a PDF has no calendar control, so there it is a text field whose initial text is the format. There is no block form.
[datepicker, name, format, width|height]
| Slot | Description |
|---|---|
name | Unique field name |
format | The date pattern, for example yyyy-MM-dd; empty, MM/dd/yyyy |
width|height | Field dimensions in points |
{ "p": "Effective date: [datepicker, effectiveDate, yyyy-MM-dd, 140|22]" }
Signature field
An empty signature field: a place reserved, unsigned, for someone to sign later in a PDF reader — an approver, a witness, a countersignature. (Signing the document as it is rendered is the signature section, a different thing; the two work together.) A field can say which other fields its signing locks, and carry seed values that tell the signer's software what the signature must use.
[signature, name, width|height, key=value, key=value, ...]
{ "p": "Witness [signature, witnessSig, 150|40, reasons=Witnessed|Witnessed with reservations, lock=exclude:remarks]" }
The tag's key=value slots, list values split on |:
| Slot | Block equivalent | Description |
|---|---|---|
reasons=a|b | seedValue.reasons | The reasons a signer chooses from. |
timeStamp=URL | seedValue.timeStamp.url | The timestamp authority a signer is asked to use; written for the signer's software, never called here. |
required=… | seedValue.required, seedValue.cert.required, seedValue.timeStamp.required | Which of the entries are required rather than suggested: reasons, timeStamp, subject, issuer, oid, subjectDN, keyUsage. |
subject=a.cer|b.cer | seedValue.cert.subject | Certificate files (DER or PEM) acceptable for signing. |
issuer=ca.cer | seedValue.cert.issuer | Certificate files of acceptable issuers, directly or through the chain. |
oid=1.2.3 | seedValue.cert.oid | Certificate policy OIDs the signing certificate must carry; needs issuer. |
subjectDN=O:Harbour|C:NL | seedValue.cert.subjectDN | Attributes the signer's subject must contain, as ATTRIBUTE:value pairs (one set). |
keyUsage=digitalSignature|nonRepudiation | seedValue.cert.keyUsage | Key usages the signing certificate must have. |
url=URL | seedValue.cert.url | Where a signer can enrol for an acceptable certificate. |
lock=all, lock=include:a|b, lock=exclude:a|b | lock.action, lock.fields | Which fields are locked once this field is signed: all, only those listed, or all but those listed. |
lockPermissions=… | lock.permissions | What may still change after: unspecified, noChanges, formFilling (the default) or annotating. Written only in a PDF 2.0 file (metadata.pdfVersion); in 1.7 it is reported and left out. |
A key the tag does not take, or a value it cannot read, is reported and ignored.
The block form carries the same as two objects, lock and seedValue, on a field whose fieldType is signature:
{
"field": {
"label": "Lessee signature",
"name": "lesseeSignature",
"fieldType": "signature",
"width": 220,
"height": 56,
"lock": { "action": "include", "fields": ["term", "invoicing"], "permissions": "noChanges" },
"seedValue": {
"reasons": ["I accept the lease", "I accept the lease with the reservations attached"],
"required": ["reasons"],
"timeStamp": { "url": "https://timestamp.example.org", "required": false },
"cert": { "issuer": ["certs/harbour-signing-ca.cer"], "keyUsage": ["digitalSignature", "nonRepudiation"] }
}
}
}
lock key | Default | Description |
|---|---|---|
action | all | all, include (only the fields) or exclude (every field but the fields). |
fields | — | The field names; required by include and exclude, refused beside all. |
permissions | formFilling | What may still change once signed, as above. |
seedValue needs at least one of reasons, timeStamp or cert; cert needs at least one of its entries, and timeStamp.required: true needs a url. With required: ["reasons"] and no reasons listed, the field asks that no reason be given at all.
In a DOCX, which has no signature-field control, the field, its lock and its seed values are not written, and the render reports each.
Approval form — putting it all together
{
"content": [
{ "h2": "Approval Form" },
{ "p": "Reviewer: [textfield, reviewer, , 250|22]" },
{ "p": "Department: [choicefield, dept, Engineering|Legal|Finance, 0, 200|22]" },
{ "p": "Decision:" },
{ "p": "[radio, approve, decision, false, 14|14] Approved" },
{ "p": "[radio, reject, decision, false, 14|14] Rejected" },
{ "p": "[radio, defer, decision, false, 14|14] Deferred" },
{ "p": "[checkbox, final, false, 14|14] This decision is final and binding" },
{ "p": "Effective: [datepicker, effective, , 140|22]" },
{ "p": "Notes:[br][textarea, notes, , 400|80]" },
{ "field": { "label": "Reviewer's signature", "name": "reviewerSig", "fieldType": "signature", "width": 220, "height": 50,
"lock": { "action": "include", "fields": ["decision", "final"] } } }
]
}