Skip to content
ComPDF
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Forms

The WebViewer supports AcroForm fields — text fields, checkboxes, radio buttons, list boxes, combo boxes, and push buttons — plus a form-field creation board and a properties panel. This guide covers the UI-side form APIs.

Form field data models and PDF integration live in the closed-source Core engine (packages/core/src/form/). The UI layer drives them through the core bridge and mirrors form state in the document store.

Form field types

FieldTool nameNotes
Text fieldTextfieldSingle/multi-line text input.
CheckboxCheckboxCheck style configurable.
Radio buttonRadiobuttonGrouped.
List boxListboxSelect one option.
Combo boxComboboxDropdown.
Push buttonPushbuttonAction button (text, link, etc.).
SignatureSignatureSee Signatures.

UI APIs

UI.setFormBoardFold(fold)

Fold or unfold the form board.

javascript
UI.setFormBoardFold(true);   // fold

Toggles formBoardFold in the viewer store, controlling the form-field creation palette visibility.

UI.setFormBoardPosition(position)

Set the form board position.

javascript
UI.setFormBoardPosition({ left: 100, top: 200 });  // or a preset string

Sets formBoardPosition { left, top } in the viewer store.

UI.setHighlightForm(value)

Toggle highlighting of form fields.

javascript
UI.setHighlightForm(true);

Calls useDocument.setHighlightForm(value), which stores the flag and pushes it into the engine via core.setHighlightForm.

The form board

components/FormBoard/FormBoard.vue is the form-field creation palette, rendered below the header when the form toolbar group is active. It offers the field-creation tools; selecting one activates the corresponding tool via setToolState, which calls core.setTool and core.setInitProperty to seed the new field's default style.

The board state lives in the viewer store: formBoardFold, formBoardPosition, enableFillForm, skipNoRequired, consecutiveType.

The form properties panel (right panel)

The right panel (components/RightPanel/) shows form-field properties across three tabs, switched by UI.setActiveElementTab('rightPanel', tab):

TabContents
GeneralField name, button text (push button), visibility, required/indicator flags.
AppearanceFill color, font color/family/style/size (hidden for signature fields).
PreferenceAlignment, default value, multi-line (textfield); button style (checkbox/radio); options (listbox/combobox). Hidden for signature fields.

The panel model is the propertyPanel object in the document store (fieldName, isHidden, title, fillColor, color, fontName/Style/Weight/Size, textAlignment, contents, isMultiLine, checkStyle, isChecked, actionType, text, url, destPage, items[], etc.). Mutations go through core.setPropertyPanel.

Core bridge (form surface)

The core bridge exposes on instance.Core:

FunctionPurpose
handleFieldForm-field handling.
enableSkipNoRequired / disableSkipNoRequired / isSkipNoRequiredSkip non-required fields.
setConsecutiveType / getConsecutiveTypeConsecutive fill type.
disableFillConsecutively / isFillConsecutivelyConsecutive fill control.
getFormSignFilledAndUnfilledFilled/unfilled form+signature counts.
getRequiredFormSignRequired form/signature fields.
setAutoJumpNextSignAuto-jump to next signature field.

Examples

Highlight form fields

javascript
UI.setHighlightForm(true);

Open the form properties panel on Appearance

javascript
UI.openElement('rightPanel');
UI.setActiveElementTab('rightPanel', 'Appearance');

Auto-jump to the next signature field

javascript
UI.setAutoJumpNextSign(true);   // also pushes to core