0

Im using Pdfnet on a windows 8.1 project, i would like to know if there is a way to do a autosave when user inserts or removes a annotation (ink, highlight, etc...), or at least detect when a annotation is added to the document ( i can do the save then )

Edit:

I managed to do a kind of autosave using

_ViewModel.PDFViewCtrl.GetAnnotationCanvas().ManipulationCompleted += MainPage_ManipulationCompleted;

and in that event i save the document everytime its triggered, works for well except for "note" annotations, that dont trigger the event when inserted.

Thought
  • 5,326
  • 7
  • 33
  • 69
  • Are you using the PDFViewCtrlTools project to handle adding annotations? If so, you can register for ToolManager's AnnotationAdded, AnnotationEdited, and AnnotationRemoved events. – Ryan May 05 '16 at 22:27
  • i have this variable anBar = new pdftron.PDF.Tools.Controls.AnnotationToolbar(); – Thought May 06 '16 at 07:54
  • then when i do anBar.ToolManager.AnnotationAdded += ToolManager_AnnotationAdded , the event trigger on note, highlight and erase, but it doesnt trigger on ink ( these are the 4 options i have no my toolbar) – Thought May 06 '16 at 08:01

1 Answers1

0

I would recommend creating the ToolManager yourself, and then setting the Annotation Toolbar's toolmanager.

ToolManager toolManager = new ToolManager(myPDFViewCtrl).
anBar.ToolManager = toolManager;
toolManager.AnnotationAdded += ToolManager_AnnotationAdded;

Finally, since all this code is open source, I would recommend just sticking a breakpoint in the CommitAnnotation function in FreeHandCreate. Follow the execution, and see what might be going wrong.

Ryan
  • 2,473
  • 1
  • 11
  • 14