How to add Cloud annotation programatically?

Please fill out the following template as best you can. .
Which product are you using?
PDF.js Express Plus

PDF.js Express Version

Detailed description of issue
How can I add the cloud annotations programmatically ?

Code snippet

I am adding simple polygon tool like below how to add cloud annotations ?

const createPolygonAnnotations = (annotationData: any, doc: any, Annotations: any, annotationsManger: any) => {
        const polygonAnnotation = new Annotations.PolygonAnnotation();
        polygonAnnotation.PageNumber = Number(;
        const vertices = convertToCoordinateObjects(annotationData.coordinates) = vertices
        polygonAnnotation.CustomData = {
          addedType: 'programmatically',

return polygonAnnotation;


Hi Shahid,

To clarify, are you referring to this tool in the shapes ribbon group?

Best Regards,

Now it working I just need to se the border style using the setBorderStyle(‘cloudy’)


1 Like