Some test text!

menu

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, 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);
    })

  })

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.