Detecting unsaved changes in PDFs
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}`);});In Nutrient Web SDK 1.24.0 and later, instance.applyOperations() and Document Editor Save persist pending changes before applying document operations. This also applies with autosave disabled. After a successful save and operation, hasUnsavedChanges() returns false. If saving fails, applyOperations() rejects with a SaveError and doesn’t apply the operations.