In This Topic
Reference Guides / JavaScript API / Annotations / AddAnnot

AddAnnot

In This Topic

This function allows you to add one or more annotations programatically (without user interaction) onto a document into the DocuVieware™ viewer.

AddAnnot: function (docuViewareID, annotationObject, success, error)

Parameters

docuViewareID
The identifier for the DocuVieware™ instance you want to add the annotation on.
annotationObject
A JavaScript object (or an array of objects) that contains the annotations to draw. It has the following prototype:
{
   type: int,
   pageNo: int,
   coordinates: {
      left: float,
      top: float,
      height: float,
      width: float
   },
   appearance: {
      // depends on the type, please refer to the corresponding Add***AnnotInteractive method documentation for supported properties.
   }
}

- type is the integer value of the member of the GdPictureAnnotationType enumeration (see list below).
- pageNo is an integer that represents the page number you want the annotation to be drawn on.
- coordinates contains the size and location (as float in inches relative to the page) of the annotation on the page.
- appearance is an object that contains the annotation style properties. Please refer to the corresponding interactive method documentation to see the complete list of properties for each annotation type.

success
A function that will be executed upon success.
error
A function that will be executed upon error.
Annotation Type
Rubberstamp 0
Rectangle 1
Rectangle Highlighter 2
Line 3
Line arrow 4
Connected line 5
Ellipse 6
Embedded image 7
Text 8
Sticky note 9
Freehand 10
Freehand highlighter 11
Freehand polygon 12
Link 13
Polygon 14
Ruler 15
Polyruler 16

You can see an example of usage of this method in the provided Barcode Recognition demo ASP.NET application (available in both Webform and MVC flavors).

Example of usage

This code create an image annotation in a DocuVieware™ instance.

var imageData = "iVBORw0KGgoAAAANSUhEUgAAAKkAAABDCAIAAABoaLKcAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAJOgAACToAYJjBRwAAAKCSURBVHhe7ZpPjoMgHIXnILOc07DyLC48i4lHMR5Fb9CFcWFMmnT6B6EoRXCi4rz35bcZ80CmnyC1ft0IKnSPC93jQve40D0udI8L3eNC97jQPS50jwvd40L3uNA9LnSPC93jQve4bO2+6cXP5fteSV/LQ3bqqnvEfi6iGOQhzZAmz06cJYqrjL/wPrUkND+huZZFJ5JWjefZVSuyvmzMgcVCPO6L8VPLZu5VJ+6aNNzNfTPkmal8XkmXNzIeDSdz36ZZ96nySsYl+7jXY5MlknFIkzVgvjIdzLncr7OynXtDfJtWFrV19Z65pJML9EjoXhF8lmuudyFdKQ9aGVIZW0zuCd0rQvPj5vQ+45fv5arziKY+3SvC8m+Tfj5gG2U25oP+iw2he0VYXi/jvvNYrxORLPt0rwjKrxCp+ve5R+zBbu6dX88e5VhClzvpLQK2dK+v1IDLMXyp2Jb93HuXy/3HsnyadL8A3SvWuZ+P9iN6ewjmfukDPdf9nvPeA7rXKPdoe73/5f5v+3x+xzM5mXst0ncSr1oqNoXuFWF5ffP2+3VOb/Si+TWP7hWBef2M1mcND3r4vxN0r1idv1c2uJqYSXnweOheEX4WPeZHq660Tei66rT4WHZ5L87l3v1gePLqhE+r9yah+Sfl9G2tVqjw9N09+8VxHCdz76zJKXxavTcJzY+YM9tewn1TOIZ43I+7odXv6c4uGo9WxqhC8wZ11adZK4we7n92aRGh9RdbuyfxQve40D0udI8L3eNC97jQPS50jwvd40L3uNA9LnSPC93jQve40D0udI8L3eNC97jQPS50jwvd40L3uNA9LnSPC93jQve40D0udI/K7fYLKhpvPPRA4B4AAAAASUVORK5CYII=";
           
           
DocuViewareAPI.AddAnnot("DocuVieware1", {
                type: 7,
                pageNo: 1,
                coordinates: {
                    left: 0,
                    top: 0,
                    height: 5,
                    width: 5
                },
                appearance: {
                    bitmapData:imageData
                }
            });
           
           

Return Value

1 if error, 0 if success.