PDFViewer.hasUnsavedChanges
true from the first change on — a tool's, a page's, a field filled in or signed, the document API's, an undo — until the document is exported whole by an exporter from createExporter() (the toolbar's Download; download(), getBlob(), getArrayBuffer(), getBase64(), uploadTo() without pages) or markSaved() is called. A change made while an export ran stays unsaved; an undo back to the saved state still counts. documentChanged reports every change of it; nothing reports it going back to false. The export is the "save": a host that uploads the bytes keeps its own flag for an upload that failed, or a "leave without saving?" guard lets the user go after one — see Saving as the user works.getterPropertiessince 1.0.0
Signature
get hasUnsavedChanges(): boolean
Returns
boolean
Example
TypeScript
window.addEventListener('beforeunload', (e) => { if (viewer.hasUnsavedChanges) e.preventDefault(); });