This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/annotations/detecting-if-annotations-have-changed.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Check if a PDF annotation has changed using JavaScript | Nutrient Web SDK

In addition to managing annotations with the create, update, and delete APIs, we also provide events that let you intercept annotation changes made through the user interface (UI) or synced from the server.

EventUse case
annotations.loadTriggered when annotations are loaded from the document.
annotations.willChangeTriggered before a user modifies an annotation through the UI (for example, by drawing).
annotations.changeTriggered when annotations change due to a user action or API call.
annotations.createTriggered when new annotations are created.
annotations.updateTriggered when existing annotations are updated.
annotations.deleteTriggered when annotations are deleted.
instance.addEventListener("annotations.load", loadedAnnotations => {
console.log(loadedAnnotations);
});
instance.addEventListener("annotations.willChange", event => {
if (event.reason === NutrientViewer.AnnotationsWillChangeReason.DRAW_START) {
console.log("The user is drawing...");
}
});
instance.addEventListener("annotations.change", () => {
console.log("Something in the annotations has changed.");
});
instance.addEventListener("annotations.create", createdAnnotations => {
console.log(createdAnnotations);
});
instance.addEventListener("annotations.update", updatedAnnotations => {
console.log(updatedAnnotations);
});
instance.addEventListener("annotations.delete", deletedAnnotations => {
console.log(deletedAnnotations);
});