Skip to main content

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 namesUnique, 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|heightThe 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.
interactiveA trailing true or false. Every field is interactive: false (a flattened field) is not implemented, and asking for it is reported.
QuotesA 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.
TagSize when width|height is left out
textfield180 × 16
textarea180 × 48
checkbox, radio10 × 10
choicefield100 × 15
listbox120 × 100
datepicker100 × 14
signature160 × 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]
SlotDescription
nameUnique field name
defaultValuePre-filled text. Use empty string for blank, or wrap in single quotes for a value that may hold a comma
width|heightField 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]
SlotDescription
nameUnique field name
checkedInitial state: true or false
width|heightCheckbox 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]
SlotDescription
valueThe button's export value: what the group is set to when this button is on
groupThe field name the buttons share — radios sharing a group are mutually exclusive
selectedtrue or false
width|heightRadio 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]
SlotDescription
nameUnique field name
optionsPipe-separated option list
selectedIndexZero-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|heightField 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]
SlotDescription
nameUnique field name
optionsPipe-separated option list
multifalse; multiple selection is not implemented, so true is reported and a single choice is offered
width|heightField 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]
SlotDescription
nameUnique field name
formatThe date pattern, for example yyyy-MM-dd; empty, MM/dd/yyyy
width|heightField 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 |:

SlotBlock equivalentDescription
reasons=a|bseedValue.reasonsThe reasons a signer chooses from.
timeStamp=URLseedValue.timeStamp.urlThe 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.requiredWhich of the entries are required rather than suggested: reasons, timeStamp, subject, issuer, oid, subjectDN, keyUsage.
subject=a.cer|b.cerseedValue.cert.subjectCertificate files (DER or PEM) acceptable for signing.
issuer=ca.cerseedValue.cert.issuerCertificate files of acceptable issuers, directly or through the chain.
oid=1.2.3seedValue.cert.oidCertificate policy OIDs the signing certificate must carry; needs issuer.
subjectDN=O:Harbour|C:NLseedValue.cert.subjectDNAttributes the signer's subject must contain, as ATTRIBUTE:value pairs (one set).
keyUsage=digitalSignature|nonRepudiationseedValue.cert.keyUsageKey usages the signing certificate must have.
url=URLseedValue.cert.urlWhere a signer can enrol for an acceptable certificate.
lock=all, lock=include:a|b, lock=exclude:a|block.action, lock.fieldsWhich fields are locked once this field is signed: all, only those listed, or all but those listed.
lockPermissions=…lock.permissionsWhat 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 keyDefaultDescription
actionallall, include (only the fields) or exclude (every field but the fields).
fields—The field names; required by include and exclude, refused beside all.
permissionsformFillingWhat 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"] } } }
]
}