$(document).on('viewerLoaded', function() {
$('#downloadButton').off().on('click', function() {
if (downloadWithAnnotations) {
readerControl.downloadFile();
} else {
var emptyXfdf = '<xfdf></xfdf>';
readerControl.downloadFile(emptyXfdf);
}
});
});