How to use undo and redo function for annotations

I know hotkeys are available but I want to trigger undo and redo over a button click outside the viewer.
I have also tried trigger event for hotkeys but it doesn’t work.
Please suggest me something to use this default feature for undo and redo of annotations.

How to use this methods?


This doesn’t work. Please let me know the actual way to invoke that method.


To get reference to the history manager you can call docViewer.getAnnotationHistoryManager(), then you should have access to the APIs above. We will update the documenation to make this a bit more clear.

WebViewer((), ele).then(instance => {
   const { docViewer } = instance;
   const historyManager = docViewer.getAnnotationHistoryManager()


I hope this helps!