TypeError: docViewer.GetAnnotationManager is not a function

159 views
Skip to first unread message

Kai Brümmer

unread,
Aug 18, 2015, 12:41:48 PM8/18/15
to PDFTron WebViewer
Dear all,

I am working on the update from v1.8 to 2.0
I have a config.js file, which contains this code:

$(document).bind("viewerLoaded", function(event) {
    readerControl.fitPage();
    var docViewer = readerControl.docViewer;
    console.log(docViewer);
    var annotManager = docViewer.GetAnnotationManager();
...
});

The line "readerControl.fitPage();" causes the viewer to show the file in fitpage mode, but then it throws this error in console:
TypeError: noteManager is undefined
http:// ... /PDFTron/html5/NotesPanel.js (line 1652, col 16)


In the line "var annotManager = docViewer.GetAnnotationManager();" I get this error:
TypeError: docViewer.GetAnnotationManager is not a function
http:// ... /PDFTron/html5/external/jquery-2.1.0.min.js line 2 > eval (line 20, col 20)
In the dom object shown in console (line above), I can see that the function is there.

Thank you in advance for your help

Matt Bojey

unread,
Aug 18, 2015, 1:13:35 PM8/18/15
to PDFTron WebViewer
Hi,

To fix the first error you need to call the fitPage() function after the 'documentLoaded' event instead of the 'viewerLoaded' event.  Without the document the function will not work.

  $(document).bind('documentLoaded', function(event) {
        readerControl
.fitPage();
   
});

To fix the error with annotManager you will need to change to use the getAnnotationManager function.  The name of the function was changed as part of the upgrade to 2.0, you can see all changes here

Matt

Kai Brümmer

unread,
Aug 19, 2015, 12:28:30 PM8/19/15
to PDFTron WebViewer
Sorry, I didn't see the lowercase/uppercase difference :-(
fitPage works fine, too.
Thank you Matt
Regards Kai
Reply all
Reply to author
Forward
0 new messages