Product Version: 9.2.279502
When the user taps the Undo or Redo buttons in the toolbar, I would like a callback that lets me know which annotations are affected, and whether they were added, deleted, or modified.
I have not found this callback in the docs.
The PTToolManagerDelegate callbacks (e.g.
are not called when Undo or Redo are called.
The NSNotifications (e.g.
PTUndoRedoManagerDidUndoNotification) do not contain any useful info.
Am I just missing this callback from somewhere? Or is it not possible?
If collab or external manager is enabled, you can get the changed XFDF with the [externalAnnotationManager GetLastXFDF] API.
Other than that there is no other easy way to know which annotation were changed. This is something that we could add it as a feature request to our roadmap. Please let us know if that is something you are looking for.
PDFTron Systems, Inc.
This is something that would help us. We allowing users to save the annotations before they dismiss the view. During that save we check the document’s whole XFDF so that we are in parity. But if the user pushes the undo or redo after they have saved their state then they dismiss the view the document’s annotations will be out of sync. It works generally, because most people won’t undo after a save but not having a delegate for when they select undo or redo it allows the undo manager to be out of sync with our backend stored annotations. We are keeping track of their annotations but the three delegates annotationAdded, modified, and removed. Once they save it will be all in sync, but if they happen to undo something after they save we have no way of knowing without a delegate.
Have you tried using the
PTUndoRedoManagerDidRedoNotification notifications? They are posted whenever changes to the document are undone or redone.