How to rotate/flip Annotations by 180 degrees?

I want to rotate/ flip vertically and horizontally the annotations by 180 degrees. ? How can I do that.
I have annotations to rotate - AnnotationCreateDistanceMeasurement, AnnotationCreateAreaMeasurement
I came to know about this feature from this site -
https://pdfjs.express/api/Annotations.Annotation.html

How to invoke Annotations. Annotation for Rotation.

Rotation (number) Gets or sets the annotation’s clockwise rotation in degrees. Valid values are 0, 90, 180 and 270. Only applies to Stamp, FreeText and Caret annotations.

Hi Kirin,

You can not set the rotation of AnnotationCreateDistanceMeasurement annotation by setting the rotation property. The rotation property only applies to Stamp, FreeText and Caret annotations. We can however use the functions setStartPoint and setEndPoint to create the desired rotation. Here is an example where any instance of a line annotation (this includes AnnotationCreateDistanceMeasurement) which is horizontal will toggle between 90deg and 0deg rotation.

 const { Annotations, annotManager } = instance;
 
  const annotations = annotManager.getSelectedAnnotations()
      annotations.forEach(annot => {
        if(annot instanceof Annotations.LineAnnotation) {
          const xStart = annot.Start.x;
          const yStart = annot.Start.y;
          const xEnd =  annot.End.x;
          const yEnd =  annot.End.y;
          const xLength = xEnd - xStart;
          const yLength = yEnd - yStart;
          annot.setStartPoint(xStart,yStart);
          annot.setEndPoint(xStart+yLength, yStart+xLength);
          annot.adjustRect();
        
    } 
  });  

Let me know if you have any more questions,

Dustin