Manually adding StickyNotes but not displaying on pdf screen

Hi ,
I am manually entering sticky note using below code by applying onClick event.
After clicking on pdf area I am getting stickyNote value on Comment Box but not displaying on pdf screen.
It gets displayed after I clicked the added comment in comment panel…

const rectangleAnnot = new instanceReference.current.Core.Annotations.StickyAnnotation();
    rectangleAnnot.PageNumber = 1;
     rectangleAnnot.X = coordinate.x;
     rectangleAnnot.Y = coordinate.y;
     rectangleAnnot.Width = 200;
 rectangleAnnot.Height = 50;
     rectangleAnnot.setContents(val);

Hello there,

To get the annotation to appear on the viewer, you need to call the addAnnotation and redrawAnnotation APIs in our Annotation Manager class.

Please see the code snippet below:

const { Annotations, annotationManager, documentViewer } = instance.Core;

annotationManager.addAnnotation(rectangleAnnot);
// need to draw the annotation otherwise it won't show up until the page is refreshed
annotationManager.redrawAnnotation(rectangleAnnot);

Here is a link to our API documentation.

Hope this helps.

Best Regards,
Darian Chen