How to remove specific annotations on document close and persist the change, without interfering with Acrobat's Save/Don't Save dialog?
I'm developing an Acrobat plugin (C++) that needs to automatically remove specific custom stamp annotations (calculator tape annotations) when the document is closed, based on a user preference setting.
The requirement: When the preference "Clear Calculator Tape on Save" is enabled, any calculator tape annotations should be removed from the document when it is closed, so that upon reopening, the tapes are no longer present.
I’ve tried few things like:
1. AVDocWillCloseNSEL with PDDocSave: I registered for AVDocWillCloseNSEL, removed the annotations in the callback, and called PDDocSave(doc, PDSaveIncremental, ...) to persist the removal. This works when the document is clean (no unsaved changes). However, when the document has unsaved non-tape changes (e.g., an unsaved symbol annotation) and the user clicks "Don't Save" on Acrobat's prompt, my PDDocSave call still writes to disk — effectively overriding the user's "Don't Save" intent for the other changes
2.PDDocWillSaveNSEL (no explicit save): I registered for PDDocWillSaveNSEL and removed the tape annotations inside the callback, relying on the in-progress save to commit the removal. This works perfectly fine , except as u can see it forces the tape removal every time user hits save and not when he closes the document which is not at all the requirement
So is there a way that i can only save the remove calc tape change and ignore all other unsaved changes? Does PDDocSave() alllow any overload?
Any help would be appreciated
