How to burn annotations on image?
In This Topic
1. JavaScript API for burning annotations on image in HTML5 web browser
Here is JavaScript code that shows how to burn annotations on image, save image with annotations to a new file and download new file from server:
// create an annotation viewer
var annotationViewer = new Vintasoft.Imaging.Annotation.UI.WebAnnotationViewerJS("WebAnnotationViewer1");
...
// get image that is focused in annotation viewer
var image = annotationViewer.get_FocusedImage();
// if annotation viewer has focused image
if (image != null) {
// get annotation controller that is associated with annotation viewer
var annotationController = annotationViewer.get_AnnotationController();
// burn annotation collection on image and save changed image to a new file
annotationController.burnAnnotationCollection(
image,
false, // specify that changed image must be saved to a new file
__annotationController_burnAnnotationCollection_success,
__annotationController_burnAnnotationCollection_error);
}
/*
* Annotations are successfully burned on image.
*/
function __annotationController_burnAnnotationCollection_success(data, status, e) {
// get information about new image
var newImageInfo = data.imageInfo;
// get identifier (name) of new image file
var newImageId = newImageInfo.fileInfo.id;
// download new image file
Vintasoft.Imaging.VintasoftFileAPI.downloadImageFile(newImageId, __onDownloadFile_success, __onDownloadFile_error);
}
/*
* Annotations are not burned on image.
*/
function __annotationController_burnAnnotationCollection_error(data, status, e) {
alert('Burn annotations error.');
}
/*
* Image file is successfully downloaded from server.
*/
function __onDownloadFile_success(data) {
// get a blob, which contains data of downloading file
var blob = data.blob;
// get name of downloading file
var filename = data.filename;
...
}
/*
* Image file is not downloaded from server.
*/
function __onDownloadFile_error(data) {
alert('File download error.');
}
2. Web Document Viewer UI for burning annotations on image in HTML5 web browser
By default annotation toolbar contains "annotationActionsToolbarPanel" panel that contains "burnAnnotationsButton" button. "BurnAnnotationsButton" button burns annotations on image that is focused in annotation viewer.
Here is screenshot of annotation toolbar in web application ("burnAnnotationsButton" button is marked with red rectangle):