Skip to main content
Known Participant
August 26, 2021
Question

[pdf embed api] highlight annotation default color

  • August 26, 2021
  • 1 reply
  • 493 views

Hi all,

Is there any way to change the default color of the highlight annotation to a random one?

I want that each time i highlight a text with annotation i could give it a different color.

    This topic has been closed for replies.

    1 reply

    Joel Geraci
    Community Expert
    Community Expert
    August 26, 2021

    Yes. Look at the "startAnnotationMode API" section of the documentation. The code will look like this except you'll be generating your own color.

     

    const mode = "highligh";
    const options = {
      defaultColor: "#b80000"
    };
    
    previewFilePromise.then(adobeViewer => {
            adobeViewer.getAnnotationManager().then(annotationManager => {
                    annotationManager.startAnnotationMode(mode, options)
                            .then(result => console.log(result))
                            .catch(error => console.log(error));
       });
    });