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:
WebViewer(...)
.then(instance => {
const = { Annotations, annotManager, docViewer } = instance;
docViewer.on('documentLoaded', () => {
const stampAnnot = new Annotations.StampAnnotation();
stampAnnot.PageNumber = 1;
stampAnnot.X = 100;
stampAnnot.Y = 250;
stampAnnot.Width = 275;
stampAnnot.Height = 40;
// put your data URI here
stampAnnot.ImageData = 'data:image/png;base64,iVBOR....';
stampAnnot.Author = annotManager.getCurrentUser();
annotManager.addAnnotation(stampAnnot);
annotManager.redrawAnnotation(stampAnnot);
})
})
WebViewer(...)
.then(instance => {
const = {
Annotations,
annotationManager,
documentViewer
} = instance.Core;
documentViewer.addEventListener('documentLoaded', () => {
const stampAnnot = new Annotations.StampAnnotation();
stampAnnot.PageNumber = 1;
stampAnnot.X = 100;
stampAnnot.Y = 250;
stampAnnot.Width = 275;
stampAnnot.Height = 40;
// put your data URI here
stampAnnot.ImageData = 'data:image/png;base64,iVBOR....';
stampAnnot.Author = annotationManager.getCurrentUser();
annotationManager.addAnnotation(stampAnnot);
annotationManager.redrawAnnotation(stampAnnot);
})
})
Other examples
Creating rectangle annotations
To create a rectangle annotation.
Creating free text annotations
To create a free text annotation.
Creating highlight annotations
To create a highlight annotation.
Creating file attachment annotations
To create a file attachment annotation.
Creating custom annotations
To create a customized annotation.