Skip to content

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

Forms ​

The WebViewer can fill existing form fields and create new ones. This guide covers the form tools, the form fill navigator, and the form APIs.

Form field types ​

TypeTool nameWidget class
Text fieldTextFormFieldCreateToolTextWidgetAnnotation
Check boxCheckBoxFormFieldCreateToolCheckButtonWidgetAnnotation
Radio buttonRadioButtonFormFieldCreateToolRadioButtonWidgetAnnotation
List boxListBoxFormFieldCreateToolListWidgetAnnotation
Combo boxComboBoxFormFieldCreateToolChoiceWidgetAnnotation
Push buttonPushButtonFormFieldCreateToolPushButtonWidgetAnnotation
SignatureSignatureFormFieldCreateToolSignatureWidgetAnnotation

The form tools are in the toolbar group toolbarGroup-Forms (grouped items formsGroupedItems).

UI APIs ​

UI.setFormFillNavigatorCollapsed(collapsed) ​

Collapse or expand the form fill navigator.

javascript
/**
 * @method UI.setFormFillNavigatorCollapsed
 * @param {boolean} collapsed
 */
UI.setFormFillNavigatorCollapsed(true);

UI.setFormFillNavigatorPosition(position) ​

Move the form fill navigator. The position is relative to the UI root element; left or top can be given alone.

javascript
/**
 * @method UI.setFormFillNavigatorPosition
 * @param {object} position { left?: number, top?: number } in px
 */
UI.setFormFillNavigatorPosition({ left: 100, top: 80 });

Highlight form fields ​

Form field highlighting belongs to the Core FieldManager:

javascript
const fieldManager = instance.Core.annotationManager.getFieldManager();
fieldManager.enableWidgetHighlighting();
// fieldManager.disableWidgetHighlighting();

UI.FormFill ​

UI.FormFill reads the navigation state of the form fill navigator: getFields(), getCurrent(), getAdjacent(1 | -1), getSettings() and setSettings(patch).

The form fill navigator ​

The form fill navigator is a floating board that moves between the fields of the document (previous / next) while the user fills the form. It can be collapsed and dragged.

The form properties panel ​

The right panel formFieldPanel shows the properties of the selected form field. It opens from the formFieldPanelToggle button in the forms tools, or with UI.openElement('formFieldPanel').

Core (form surface) ​

APIPurpose
annotationManager.getFieldManager()Fields of the document, widget highlighting.
annotationManager.addAnnotation(widget)Add a form field widget.
Annotations.TextWidgetAnnotation and other widget classesCreate form fields in code.

See Create Form Fields.

Examples ​

Highlight form fields ​

javascript
instance.Core.annotationManager.getFieldManager().enableWidgetHighlighting();

Open the forms tools and the form properties panel ​

javascript
UI.setToolbarGroup('toolbarGroup-Forms');
UI.setToolMode('TextFormFieldCreateTool');
UI.openElement('formFieldPanel');

Auto-jump to the next signature field ​

javascript
UI.enableFeatures([UI.Feature.AutoJumpNextSignature]);