This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/annotations/create-edit-and-remove/edit.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Edit PDF annotations using JavaScript | Nutrient SDK

In addition to an API for creating annotations, we also provide an API for updating those annotations directly on the client. Following the optimistic UI approach, the UI shows changes instantly, but they aren’t persisted until you save the annotations.

To update annotations, use Instance#update. Try this example in the Playground:

NutrientViewer.load(configuration)
.then(async (instance) => {
try {
const annotations = await instance.getAnnotations(0);
console.log(`Found ${annotations.size} annotations`);
if (annotations.size === 0) {
console.warn("No annotations found on page 0");
return;
}
const annotation = annotations.get(0);
const updatedAnnotation = annotation.set("opacity", 0.5);
await instance.update(updatedAnnotation);
console.log("Annotation updated.");
} catch (error) {
console.error("Failed to update annotation:", error.message);
}
})
.catch((error) => {
console.error("Failed to load NutrientViewer:", error.message);
});

Once you edit annotations, you need to persist them by saving them. Save them to external storage or embed them into the document. You can also export them to XML Forms Data Format (XFDF) or Instant JSON. If you’re using Web SDK with Document Engine, you can sync them with the backend.