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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I finally worked it out.
I can’t post my code here, but here’s what I did:
I rendered the PDF onto 2 canvases, one small for the thumbnail and one huge for printing (hidden). I then had a print button that opened a new window containing an
imgtag containing the contents of the huge canvas usingtoImageURL(). Theprint()function was called on the new window, followed byclose()to close it automatically once printed.This resulted in an almost-full-size print of the PDf, albeit with the usual page no and datestamp from the browser.