Custom stamp delete event

WebViewer Version: 8.2.0

Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? Yes
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? No
Is your issue related to annotations? Yes

Please give a brief summary of your issue:
We could create customized stamps in StampCreateTool, is there any events for stamp saved or stamp deleted events similar to signature?

Please describe your issue and provide steps to reproduce it:

  1. Click Insert tab
  2. Select Rubber Stamp
  3. Click Create New Stamp and customize the rubber stamp
  4. Click Create
  5. Add the stamp to the document
  6. Delete the customized stamp

I read through the API and found that there is only annotationAdded event which is fired when an annotation is added to the document, however there is no events for deleting customized stamps.

Please provide a link to a minimal sample where the issue is reproducible:

Hello Donald,

The StampCreateTool is only responsible for creating the annotation, but not deleting it. The delete event is triggered on the AnnotationManager instead: PDFTron WebViewer Class: AnnotationManager.

Let me know if this helps!

Hi,

So there’s no events fired when I click the delete buttons in the red rectangle area in the attached screenshot?

Thanks for the clarification!

There actually is an undocumented event that you could leverage. It does not indicate the type of action being taken, but it does provide a list of custom rubber stamps you have created. The event is the stampsUpdated event on the RubberStampCreateTool.

instance.Core.documentViewer.getToolModeMap().AnnotationCreateRubberStamp.addEventListener('stampsUpdated', customStamps => console.log(customStamps));

You can do a comparison of a before and after to determine if a stamp was removed. The getCustomStamps API may help.

instance.Core.documentViewer.getToolModeMap().AnnotationCreateRubberStamp.getCustomStamps();

I am facing a similar issue. I have set a confirmation dialog on delete but as soon as the user clicks on the delete button it removes the stamp from the list and if the user cancels the request the stamp isn’t there anymore in the list. It shows up when we open the file again but it’s not a great user experience. Is there a way to catch that delete event so that confirmation and all our logic can be called from there and stamp doesn’t disappear beforehand