Creating stamp annotations using JavaScript

Stamp annotations can be created from an image as a data URI. The key property for stamps is ImageData which you set with the value of your data URI. For example:

1WebViewer(...)
2 .then(instance => {
3 const { Annotations, annotationManager, documentViewer } = instance.Core;
4
5 documentViewer.addEventListener('documentLoaded', () => {
6 const stampAnnot = new Annotations.StampAnnotation();
7 stampAnnot.PageNumber = 1;
8 stampAnnot.X = 100;
9 stampAnnot.Y = 250;
10 stampAnnot.Width = 275;
11 stampAnnot.Height = 40;
12 const keepAsSVG = false;
13 stampAnnot.setImageData('image data (URL or base64) goes here', keepAsSVG);
14 stampAnnot.Author = annotationManager.getCurrentUser();
15
16 annotationManager.addAnnotation(stampAnnot);
17 annotationManager.redrawAnnotation(stampAnnot);
18 })
19
20 })

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales