How to apply Rubber stamp annotation without explicitly selecting stamp. (SOS)

I have used this method. For creating rubber stamp, I have called setToolMode() for setting the stamp on mouse click. Now I am getting that ‘+’ cursor but it doesn’t add any stamp on the webviewer. I dont want to select that standard stamp instead I want to have that stamp ready to use as soon as I call this method.
Whenever I call this method, that standard stamp should enabled on the cursor and I will be directly drawing it on the webviewer. I should not be used to select that standard stamp.

if (selectedFunction === ‘stamp’) {
const tool = this.viewerInstance.docViewer.getTool(‘AnnotationCreateRubberStamp’);
tool.setStandardStamps([‘SHAccepted’]);
tool.setRubberStamp(tool);
this.viewerInstance.docViewer.setToolMode(tool);
}

Hi!

Your code was pretty close, you were just passing the wrong thing into setToolMode. This code should work for you.

    const tool = docViewer.getTool('AnnotationCreateRubberStamp');
    tool.setStandardStamps(['SHAccepted']);
    const annots = await tool.getStandardStampAnnotations();
    tool.setRubberStamp(annots[0]);
    instance.setToolMode('AnnotationCreateRubberStamp'); // sets it in the UI

Thanks,
Logan