In PrizmDoc, how can I create a rectangular annotation that looks similar to a highlight?

Question

I know the coordinates and dimensions of the content I would like to highlight, but the highlight annotation only works on text. Is there a way to create an annotation that highlights a specific area of a document?

Answer

The best way to do this would be to create a yellow rectangle annotation with 50% opacity (these are the same default values used by the text highlight annotation). The code below demonstrates how to do this in the viewer:

//Create a new rectangle annotation
var rectangleMark = viewer.viewerControl.addMark(1,  PCCViewer.Mark.Type.RectangleAnnotation);
//Set the coordinates and dimensions of the annotation
rectangleMark.setRectangle({x: 100, y:  100,  width : 200, height: 200});
//Set fillcolor to yellow
rectangleMark.setFillColor("#FFFF00");
//Remove the border
rectangleMark.setBorderColor("transparent");
//Set opacity to 50%
rectangleMark.setOpacity(127);