// get inner HTML5 viewer window
var innerWindow = $('iframe')[0].contentWindow;
var annotManager = innerWindow.readerControl.docViewer.GetAnnotationManager();
var Annotations = innerWindow.Annotations;
var rectangle = new Annotations.RectangleAnnotation();
rectangle.X = 100;
rectangle.Y = 100;
rectangle.Width = 200;
rectangle.Height = 50;
rectangle.PageNumber = 1;
annotManager.AddAnnotation(rectangle);
var freeText = new Annotations.FreeTextAnnotation();
freeText.X = 150;
freeText.Y = 200;
freeText.Width = 150;
freeText.Height = 50;
freeText.setPadding(new Annotations.Rect(0, 0, 0, 0)); // this is a workaround for creating free text annotations, we'll improve this in the future so this line isn't required
freeText.PageNumber = 1;
freeText.setContents("My Text");
freeText.FillColor = new Annotations.Color(0, 255, 255);
annotManager.AddAnnotation(freeText);