readerControl.saveAnnotations() not working on iPad (mobile)

28 views
Skip to first unread message

Eric Boivin

unread,
Sep 12, 2017, 4:44:19 PM9/12/17
to PDFTron WebViewer
When I use the WebViewer on a computer and try to automatically save the annotations, everything works fine. But when using an iPad, readerControl.saveAnnotations() doesn't seem to work (nothing happens).
Here's the code in the config.js file:

$(document).on('documentLoaded', function () {
var annotManager = readerControl.docViewer.getAnnotationManager();
annotManager.on('annotationChanged', function (e, annotation, action) {
if (e.imported) {
return;
}
switch(action) {
case "add":
readerControl.saveAnnotations();
break;

case "modify":
readerControl.saveAnnotations();
break;

case "delete":
readerControl.saveAnnotations();
break;
}
});

});

I also tried to add a custom button in the mobile toolbar with the event readerControl.saveAnnotations() with the same results. But the button works well on a computer.

Eric Boivin

unread,
Sep 13, 2017, 1:39:34 PM9/13/17
to PDFTron WebViewer
Here is the error message from the Web Inspector:
TypeError: readerControl.saveAnnotations() is not a function. (In 'readerControl.saveAnnotations()', 'readerControl.saveAnnotations' is undefined)

 The error only happens on the mobile version.

Justin Jung

unread,
Sep 13, 2017, 7:22:34 PM9/13/17
to PDFTron WebViewer
Seems like MobileReaderControl doesn't define saveAnnotations function. Instead it's directly in click handler of saveAnnotationsBtn.
You could modify MobileReaderControl.js to add saveAnnotations function on the prototype and call the function on saveAnnotationsBtn click handler.
We'll include this change in future releases.

Justin Jung
Software Developer
PDFTron Systems Inc.

Eric Boivin

unread,
Sep 14, 2017, 12:08:17 PM9/14/17
to PDFTron WebViewer
I'll try it out, thanks for the help!

Best regards,
Eric
Reply all
Reply to author
Forward
0 new messages