Is there a callback with the annotation for when the user taps the Undo or Redo buttons?

Product: iOS

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?

Hi there,

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.

Sahil Behl
Software Developer
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.

1 Like

Hi Jack,
Have you tried using the PTUndoRedoManagerDidUndoNotification and PTUndoRedoManagerDidRedoNotification notifications? They are posted whenever changes to the document are undone or redone.

Yes, I need this feature