Some test text!

Loading...
Guides

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:

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;
      const keepAsSVG = false;
      stampAnnot.setImageData('image data (URL or base64) goes here', keepAsSVG);
      stampAnnot.Author = annotationManager.getCurrentUser();

      annotationManager.addAnnotation(stampAnnot);
      annotationManager.redrawAnnotation(stampAnnot);
    })

  })

Get the answers you need: Support