Replace already added RubberStampCreateTool annotations image

Hey, Is there a way of updating how an annotation looks after placing in on the pdf?

I’m creating a new RubberStampCreateTool using .svg, but I want to be able to programatically update how it looks. Can this be done?

I’ve tried setImageData but it doesn’t do anything unfortunately. The imageData of an annotation stays the same

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi Adam,

If you’d like to update an annotation after placed on a PDF file, you can use annotationManager.redrawAnnotation to redraw the annotation after using setImageData.

const stampAnnotation = // the annotation you created
stampAnnotation.setImageData(<image-url>)
instance.Core.annotationManager.redrawAnnotation(stampAnnotation);

This should update how the annotation looks.

You could also check the API doc at: PDFTron WebViewer Class: AnnotationManager.

Please let us know if this resolve the issue, thank you.