This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/save-a-document/detect-unsaved-changes.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Detect unsaved changes in PDFs | Nutrient SDK

You can check to see if there are any unsaved changes to a document by calling Instance#hasUnsavedChanges.

If you wish to react to saved state changes, you can register listeners for the document.saveStateChange event. The emitted event contains the hasUnsavedChanges property, with the current value returned by the Instance#hasUnsavedChanges method:

instance.addEventListener("document.saveStateChange", (event) => {
console.log(`Save state changed: ${event.hasUnsavedChanges}`);
});