Search

Atalasoft Knowledge Base

HOWTO: WebAnnotationViewer - Basic Tasks (Legacy Web Controls)

Administrator
DotImage

Legacy Controls NOTICE

This article references our legacy Web Forms Web Viewing controls (WebImageViewer, WebAnnotationViewer, WebThumbnailViewer). It is preserved for archival purposes, but support strongly recommends using our modern HTML5 web controls: WebDocumentViewer, WebDocumentThumbnailer instead)

INFO: WebDocumentViewer Whitepaper - Getting Started With Web Viewing

Main Article Content

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

Original Article:
Original Article: Q10186 - FAQ: WebAnnotationViewer - Basic Tasks

Details
Last Modified: 6 Years Ago
Last Modified By: Administrator
Type: HOWTO
Article not rated yet.
Article has been viewed 296 times.
Options
Also In This Category