Home : Annotations : Manipulating : WebAnnotationViewer - Basic Tasks
Q10186 - FAQ: WebAnnotationViewer - Basic Tasks

Attached you will find an ASP.NET web application showing how to accomplish basic tasks with the WebAnnotationViewer.

For this example we used the principle that we would create a layer in the WebAnnotationviewer for each page in the multipage tiff. 

Paging through a multipage Tiff

The JavaScript PrevPage() and NextPage() methods use the WebAnnotationViewer.openUrl() method to show a specific page in a multipage tiff. To do a boundary check we needed to get the page count of the tiff. We used a RemoteInvoke method to get the frame(page) count for the multipage tiff. We could have passed the value in a hidden form field but wanted to show an alternate solution.

Using JavaScript to Create an Annotation

The JavaScript CreateAnnotation() method takes an annotationType as a parameter. In the code the value is set to RectangleData. Other possible values could be:

TextData, RubberStampData, PointBaseData, LineData, InkData, HotSpotData, EllipseData. Documentation

 

Save an Annotation as XML

In the Default.aspx.cs codebehind the SaveAnnotations() method simply calls WebAnnotationViewer.Annotations.Save(). This method takes 2 parameters. The filename to save the annotations under, and an Atalasoft.Annotate.AnnotationDataFormat() object. Using the Atalasoft.Annotate.AnnotationDataFormat() object will create the file in XML(XMP) format.

 

Load Annotations from File (XML)

The LoadAnnotations() method in the codebehind first clears the existing layers. It then uses the WebAnnotationViewer.Load() method to open the XML file containing the annotations. There is also a call to CreateLayers() after the load. This is called because Load() will only create a layer for each annotation in the file and we want to create a layer for each page in the multipage tiff. Note the (for) loop in CreateLayers(), it starts at the Layers.Count value.

 

Additional Resources

A much more inclusive demo can be found in our Demo Gallery:

HTML Document Viewer Demo

 

 

Related Articles
No Related Articles Available.

Article Attachments
WebAnnotationExample.zip

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, 2019. InstantASP Ltd. All Rights Reserved