Q:When printing a page with annotations it doesn't seem to be printing the popup notes. Is there a way to do that?A:The popup notes for annotations are not printed as part of the page. What you could do is have a summary of the notes (similar to Acrobat) where the text of the notes is printed on the following page. As an example here is a simple implementation of this:In ReaderControl.js find the loadPageLoop function. Inside that function you'll see the line me.fireEvent('printProgressChanged', ...). Just after that line add the following code:
var annotManager = me.docViewer.GetAnnotationManager();
var pageNotes = annotManager.GetAnnotationsList().filter(function(annot) {
return annot.PageNumber === pages[pageIndex];
});
if (pageNotes.length > 0) {
var noteTextContainer = $('<div style="page-break-after:always">').appendTo(printDisplay);
pageNotes.forEach(function(annot) {
noteTextContainer.append('<div>' + annot.Subject + ' (' + annot.Author + '): ' + annot.getContents() + '</div>');
});
}This will add a page immediately following the document page which contains the text of the annotations' notes. You could format or style this page however you like.
var ctx = canvas.getContext('2d');
var annotManager = me.docViewer.GetAnnotationManager();
var pageNotes = annotManager.GetAnnotationsList().filter(function(annot) {
return annot.PageNumber === pages[pageIndex];
});
pageNotes.forEach(function(annot, i) {
ctx.fillText(i + 1, annot.X, annot.Y);
});
var annotManager = me.docViewer.getAnnotationManager();
var pageNotes = annotManager.getAnnotationsList().filter(function(annot) {
return annot.Listable && annot.PageNumber === pages[index] && !annot.isReply();
});
if (pageNotes.length > 0) {
var noteTextContainer = $('<div style="page-break-after:always">').appendTo(printDisplay);
pageNotes.forEach(function(annot) {
noteTextContainer.append('<div>' + annot.Subject + ' (' + annot.Author + '): ' + annot.getContents() + '</div>');
annot.getReplies().sort(function(a1, a2) {
return a1.DateCreated - a2.DateCreated;
}).forEach(function(replyAnnot) {
noteTextContainer.append('<div> ' + replyAnnot.Subject + ' (' + replyAnnot.Author + '): ' + replyAnnot.getContents() + '</div>');
});
noteTextContainer.append('<br/>');
});
}
window.isPDFiumSupported = function() {
return Promise.resolve(false);
};
var annotManager = me.docViewer.getAnnotationManager();
var pageNotes = annotManager.getAnnotationsList().filter(function(annot) {
return annot.Listable && annot.PageNumber === pages[index] && !annot.isReply();
});
if (pageNotes.length > 0) {
var $this = $(this);
$this.css('max-width', '70%');
var noteTextContainer = $('<div>').css({
position: 'absolute',
right: 0,
width: '28%'
});
var getAnnotText = function(annot) {
var subject = annot.Subject || '[No Subject]';
var author = annot.Author || '[No Author]';
return subject + ' (' + author + '): ' + annot.getContents();
};
pageNotes.forEach(function(annot) {
noteTextContainer.append('<div>' + getAnnotText(annot) + '</div>');
annot.getReplies().sort(function(a1, a2) {
return a1.DateCreated - a2.DateCreated;
}).forEach(function(replyAnnot) {
noteTextContainer.append('<div style="margin-left: 20px">' + getAnnotText(replyAnnot) + '</div>');
});
noteTextContainer.append('<br/>');
});
noteTextContainer.insertBefore($this);
}