How to attach event to displayed Icon (StampAnnotation) for custom functionality ?

30 views
Skip to first unread message

alexey....@classoos.com

unread,
Oct 19, 2016, 12:55:39 PM10/19/16
to PDFTron WebViewer
HI !

I receive data and by this data i have to display Annotations with Icons.

My question, how i can attach some event , "on click" for StampAnnotation ?

Example of the code:


var inputAnnot = new Annotations.StampAnnotation();
inputAnnot.ImageData = "data:image/png;....";
inputAnnot.Url =obj.url;
inputAnnot.Height = 32;
inputAnnot.Width = 32;
inputAnnot.Id = obj.link_id;
inputAnnot.NoMove= true;
inputAnnot.PageNumber = obj.page_number;
inputAnnot.Subject = obj.title;

var start_pos = JSON.parse(obj.start_pos.replace('{','[').replace('}',']'));

inputAnnot.X = 810 - start_pos[0];
inputAnnot.Y = start_pos[1];
inputAnnot.onclick = function (evt, originalEvt) {
alert("@@@");
};
var res = annotManager.addAnnotation(inputAnnot, false);

Thanks,

Alexey P,
Classoos

Matt Parizeau

unread,
Oct 20, 2016, 8:42:24 PM10/20/16
to PDFTron WebViewer
Hi Alexey,

You can use the code in this post but just change it from mouseMove to mouseLeftDown. https://groups.google.com/d/msg/pdfnet-webviewer/Nr1tzKtmfoo/EDw0kbRtpJ4J

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages