Product:
Webviewer
Product Version:
10.2.3
Please give a brief summary of your issue:
I can’t figure out how to programatically add measurement annotations
Please describe your issue and provide steps to reproduce it:
I am trying to add measurement annotations to the currently opened document. I can add non-measurement annotations just fine, e.g. using
const annotation = new Core.Annotations.PolygonAnnotation({
PageNumber: 1
StrokeColor: new Core.Annotations.Color(255, 0, 0, 1),
});
annotation.addPathPoint(1600.1, 300.1);
annotation.addPathPoint(1700.1, 300.1);
annotation.addPathPoint(1700.1, 400.1);
annotation.addPathPoint(1600.1, 400.1);
annotation.addPathPoint(1600.1, 300.1);
annotationManager.addAnnotation(annotation);
annotationManager.redrawAnnotation(annotation);
This creates an annotation with ToolName equal to AnnotationCreatePolygon, the same as if I would use the PolygonCreateTool or Shapes/Polygon in the UI. What I can’t figure out is how to create this annotation the same way the AnnotationCreateAreaMeasurement tool does it. I searched through the guides and the API documentation, but I found nothing. Is there a way to create the same polygon as a measurement annotation?
Please provide a link to a minimal sample where the issue is reproducible:
N/A
Thanks in advance,
David