how to get left,top,width and height when add annotation in server side

Discussions about DocuVieware integration in GdPicture.NET.
Post Reply
senthil205
Posts: 11
Joined: Tue Feb 07, 2023 6:19 am

how to get left,top,width and height when add annotation in server side

Post by senthil205 » Wed Jun 07, 2023 5:42 am

Hi sir,
we already purchase viewer

I need to get the left, top, width and height when add the annotation in viewer to store in DB after close and view the sample in need to show annotation as we add the annotation at what position.

Now i get all properties except left, top, width, height i give hardcode the height,width,left,top so please assists us.

User avatar
Fabio
Posts: 173
Joined: Thu Aug 27, 2020 9:57 am

Re: how to get left,top,width and height when add annotation in server side

Post by Fabio » Mon Jun 12, 2023 6:01 pm

Hello,

Here is a code snippet to get the coordinates of an annotation when it has been drawn in the viewer:

Code: Select all

function RegisterOnAnnotationAddedOnDocuViewareAPIReady() { 
    if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) { 
        DocuViewareAPI.RegisterOnAnnotationAdded("DocuVieware1", function (annot) { 
            var myAnnot = DocuViewareAPI.GetAnnotProperties("DocuVieware1", annot.id); 
            console.log("top: " + myAnnot.top); 
            console.log("left: " + myAnnot.left); 
            console.log("width: " + myAnnot.width); 
            console.log("height: " + myAnnot.height); 
         }); 
    } 
    else { 
        setTimeout(function () { RegisterOnAnnotationAddedOnDocuViewareAPIReady() }, 10); 
    } 
} 
document.addEventListener("DOMContentLoaded", function () { 
    RegisterOnAnnotationAddedOnDocuViewareAPIReady(); 
}, false);
Best regards,
Fabio

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest