$(document).on('documentLoaded', function () =>> have bugs on annotation ?

85 views
Skip to first unread message

nturri1306

unread,
Jan 19, 2017, 1:18:34 PM1/19/17
to PDFTron WebViewer

hello i've this code in  on config.js but have result 0 annotations is not loaded 

  $(document).on('documentLoaded', function () {


      var annotManager = readerControl.docViewer.getAnnotationManager();

        var annotationList = annotManager.getAnnotationsList();

        alert(annotationList.length)


but i click after view annotations exist what?

exist other listener after document is complete loaded?

tnx

Justin Jung

unread,
Jan 20, 2017, 3:08:36 PM1/20/17
to PDFTron WebViewer
Hello,

documentLoaded event is being triggered before the annotations are loaded. Instead you can use documentReady event.

$(document).on('viewerLoaded', function() {
    readerControl
.docViewer.on('documentReady', function(e) {

       
var annotManager = readerControl.docViewer.getAnnotationManager();
       
var annotationList = annotManager.getAnnotationsList();

        alert
(annotationList.length);
   
});
});

Justin Jung
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages