CopperPDF
CopperPDF copied to clipboard
Don't show document-related menu items until document loaded
As discussed with @Tommy-Geenexus in #7, this PR implements an onDocumentLoaded callback that enables document-related menu items such as printing.
One thing I'm not 100% happy with is that the callback is run a lot earlier than when the whole page is actually rendered. Maybe @Tommy-Geenexus can help?
Thanks @Lesik. Let's see if @Tommy-Geenexus chimes in, otherwise I'll merge this as it is, if you agree.
@Lesik @paride I will take a look over the course of the weekend, when i'm free.
@Lesik @paride
Sorry for the delay. There is a way to catch page rendering when its finished; below is a sample on how it could be implemented via a js callback (in viewer.js).
var renderTask = page.render(renderContext);
renderTask.promise.then(function () {
channel.onPageLoaded(); <- Implement callback here
pageRendering = false;
if (pageNumPending !== null) {
renderPage(pageNumPending);
pageNumPending = null;
}
});
I can't contribute code atm, as i'm very busy, but i hope this helps.