I am embedding a single page PDF in a page using pdf.js and I want to be able to print just the PDF, not the whole HTML page.
Is this possible?
We can put following code at the end of viewer.js file which will automatically print pdf:
(function () {
function printWhenReady() {
try{
if (PDFViewerApplication.initialized) {
window.print();
}
else {
window.setTimeout(printWhenReady, 3000);
}
}catch(ex){
window.setTimeout(printWhenReady, 3000);
}
};
printWhenReady();
})();