PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
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.
| Type | Tool name | Widget class |
|---|---|---|
| Text field | TextFormFieldCreateTool | TextWidgetAnnotation |
| Check box | CheckBoxFormFieldCreateTool | CheckButtonWidgetAnnotation |
| Radio button | RadioButtonFormFieldCreateTool | RadioButtonWidgetAnnotation |
| List box | ListBoxFormFieldCreateTool | ListWidgetAnnotation |
| Combo box | ComboBoxFormFieldCreateTool | ChoiceWidgetAnnotation |
| Push button | PushButtonFormFieldCreateTool | PushButtonWidgetAnnotation |
| Signature | SignatureFormFieldCreateTool | SignatureWidgetAnnotation |
The form tools are in the toolbar group toolbarGroup-Forms (grouped items formsGroupedItems).
UI.setFormFillNavigatorCollapsed(collapsed) Collapse or expand the form fill navigator.
/**
* @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.
/**
* @method UI.setFormFillNavigatorPosition
* @param {object} position { left?: number, top?: number } in px
*/
UI.setFormFillNavigatorPosition({ left: 100, top: 80 });Form field highlighting belongs to the Core FieldManager:
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 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 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').
| API | Purpose |
|---|---|
annotationManager.getFieldManager() | Fields of the document, widget highlighting. |
annotationManager.addAnnotation(widget) | Add a form field widget. |
Annotations.TextWidgetAnnotation and other widget classes | Create form fields in code. |
See Create Form Fields.
instance.Core.annotationManager.getFieldManager().enableWidgetHighlighting();UI.setToolbarGroup('toolbarGroup-Forms');
UI.setToolMode('TextFormFieldCreateTool');
UI.openElement('formFieldPanel');UI.enableFeatures([UI.Feature.AutoJumpNextSignature]);