Skip to main content
Known Participant
Aug 26, 2021 1:05 PM UTC
Question

[pdf embed api] highlight annotation default color

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 is closed to new replies. Start a new post to keep the conversation going.

    1 reply

    Joel Geraci
    Community Expert
    Community Expert
    Aug 26, 2021 2:23 PM UTC

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

      

    Translate