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.
Use these callbacks and events to synchronize form property panels and observe form-field creation and selection.
| Callback or event | Event data | Trigger |
|---|---|---|
onFormStyleDialogDismissed | { type } | The form properties panel closes. |
CPDFEvent.FORM_FIELDS_CREATED | CPDFWidget | A form field is created. |
CPDFEvent.FORM_FIELDS_SELECTED | CPDFWidget | A form field is selected. |
CPDFEvent.FORM_FIELDS_DESELECTED | CPDFWidget | null | A form field is deselected. |
The public TypeScript contract for form-field deselection is nullable; handle a null value before accessing the widget.
const onFormFieldCreated = (widget: CPDFWidget) => {
console.log('Created form field:', widget.type);
};
pdfReaderRef.current?.addEventListener(
CPDFEvent.FORM_FIELDS_CREATED,
onFormFieldCreated,
);These events do not provide form update or delete events, and they do not report save failures.
For listener lifecycle handling, see Annotations. Custom form-field actions are covered in Custom Annotation Creation Workflows.