Create Annotation on Righ click of web document viewer
Posted: Mon Sep 18, 2023 2:07 pm
Hello,
I have created annotation on contextmenu_showing method but the annotation in not proper placed in same location where mouse is right clicked , I have also used imageViewer.transformPointFromScreenToControl method , it is working in some tiff file but not working in all tiff and PDF files, it shows wrong position
Below is my code
Thanks
Jwalit Katira
I have created annotation on contextmenu_showing method but the annotation in not proper placed in same location where mouse is right clicked , I have also used imageViewer.transformPointFromScreenToControl method , it is working in some tiff file but not working in all tiff and PDF files, it shows wrong position
Below is my code
Code: Select all
function __annotationContextMenu_showing(event, eventArgs) {
// get the document viewer
var docViewer = this.get_RootControl();
// if document viewer exists
if (docViewer != null) {
var position = eventArgs.position;
var viewer = docViewer.get_ImageViewer();
var annotationVisualTool = viewer.get_AnnotationVisualTool();
let newposisiton = imageViewer.transformPointFromScreenToControl(
position.x,
position.y
);
let imageAnnotation =
new Vintasoft.Imaging.Annotation.UI.WebReferencedImageAnnotationViewJS();
imageAnnotation.set_Url("https://demos.vintasoft.com/AspNetCoreDocumentViewerDemo/Images/VintaSoftLogo.png")
imageAnnotation.set_Location(newposisiton.x, newposisiton.y);
imageAnnotation.set_Size(25, 25);
imageAnnotation.set_Border(false);
imageAnnotation.set_CanResize(false);
imageAnnotation.set_CanRotate(false);
imageViewer.addAndBuildAnnotation(imageAnnotation);
// set annotation under mouse cursor as focused annotation
AnnotationVisualTool.set_FocusedAnnotationView(imageAnnotation);
Jwalit Katira