VintaSoft Imaging .NET SDK 15.0: Documentation for Web developer
In This Topic
    How to create annotations continuously?
    In This Topic
    If you want to select annotation type in annotation toolbar and create several annotations continuously (without clicking to the annotation toolbar for each new annotation) in web annotation viewer, you need to do the following steps:

    Here is JavaScript code that shows how to subscribe to the "annotationBuildingFinished" event of the annotation visual tool and create several annotations continuously in web annotation viewer:
    // get the annotation visual tool of annotation viewer
    var annotationVisualTool = annotationViewer.get_AnnotationVisualTool();
    // subscribe to the "annotationBuildingFinished" event of the annotation visual tool
    Vintasoft.Shared.subscribeToEvent(annotationVisualTool, "annotationBuildingFinished", function (event, annotation) {
        // remove focus from created annotation
        annotationVisualTool.set_FocusedAnnotationView(null);
    
        // new annotation
        var newAnnotation = null;
        // get the type of created annotation
        var annotationType = annotation.get_Type();
        // if created annotation is ellipse annotation
        if (annotationType == "EllipseAnnotation") {
            // create new ellipse annotation
            newAnnotation = new Vintasoft.Imaging.Annotation.UI.WebEllipseAnnotationViewJS();
        }
        // if new annotation exists
        if (newAnnotation != null) {
            // add new annotation to an image and build new annotation
            annotationVisualTool.addAndBuildAnnotation(newAnnotation);
        }
    });