Home : HTML5 Web Viewing Controls : Programmatically add Annotations to WebDocumentViewer
Q10399 - HOWTO: Programmatically add Annotations to WebDocumentViewer

Our WebDocumentViewer (WDV) control differs from our WebAnnotaitonViewer (WAV) controls significantly. One such difference is programmatically creating annotations (creating an annotation without interactive user input ... such as placing an annotation of a given size at a specific location without the user having to select the location/size interactively as they do when using the clientside CreateAnnotation call)

With the WDV, you add an annotation programmatically client-side by first defining your annotation (see the Developers Guide PDF that comes with DotImage for the full WebDocumentViewer JavaScript API).

Once you've created it, you just add it to the desired pageIndex

<script type="text/javascript" language="javascript">
  function addAnno() {
    var textAnno = {
        'type': 'text',
        'x': 50,
        'y': 100,
        'width': 500,
        'height': 200,
        'fill': {
         'color': 'Ivory',
         'opacity': 1,
        },
        'outline': {
            'color': 'white',
            'width': 2,
            'opacity': 1,
        },
        'text': {
            'value': 'Example Text Here',
            'align': 'left',
            'font': {
                'bold': false,
                'color': 'black',
                'family': 'Arial',
                'size': 14,
            }
        }
    }; 
    // just for example here..
    var desiredPageIndex = 0;
    _viewer.annotations.createOnPage(textAnno, desiredPageIndex);
  }
</script>
Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2017. InstantASP Ltd. All Rights Reserved