This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/events/forms.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. JavaScript PDF form events | Nutrient

You can programmatically trigger actions synchronized with user input in document form fields. You only need to subscribe to the corresponding UI event using instance#addEventListener, and the callback you provide will be called whenever the event takes place:

instance.addEventListener("annotations.focus", function (annotationFocusEvent) {
// Will log the properties of the widget annotation that was just focused.
console.log(annotationFocusEvent.annotation.toJS());
});

Other events that can be used to detect user input in form fields besides "annotations.focus" are "annotations.blur" and "annotations.press".

For a complete list of events available for subscription, you can check out the API documentation entry for instance#addEventListener.