Debugging "Annotations could not be loaded from the server" error

42 views
Skip to first unread message

Anatoly Kudrevatukh

unread,
Mar 9, 2016, 7:49:42 PM3/9/16
to PDFTron WebViewer
Q: I am working to integrate the annotations into our application but for some reason, I can’t seem to get annotations to save and load. And everytime I attempt to load I get an error: "Annotations could not be loaded from the server"
What are some of the next steps they can take in debugging?

A:
WebViewer performs basic AJAX requests, like the following (taken from WebViewer/lib/html5/BaseReaderControl.js):
$.ajax({
    url: serverUrl,
    cache: false,
    success: function(data) {
        if (!_.isNull(data) && !_.isUndefined(data)) {
            callback(data);
        } else {
            callback(originalData);
        }
    },
    error: function(jqXHR, textStatus, errorThrown) {
        /*jshint unused:false */
        console.warn("Annotations could not be loaded from the server.");
        callback(originalData);
    },
    dataType: 'xml'
});

Fortunately, none of this code is WebViewer-specific.  So to simplify your investigation, you can execute this code in a standalone web page (entirely outside of WebViewer).

Additionally, you should take a look at the returned values jqXHR, textStatus, and errorThrown --- they might contain useful information.  

You can find AJAX request documentation at http://api.jquery.com/jquery.ajax/.
Reply all
Reply to author
Forward
0 new messages