简体   繁体   中英

How to print pdf via pdf.js in ASP web form

I use pdf.js to show the pdf in the browser, but am faced with a problem. How can I print the pdf via a print button, acting as the print function in browser or make it can just print directly.

I have tried print.js, but I cannot find out how it do that. Also, when I use

printJS('https://cdn.rawgit.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf')

it will create another windows with a link in a browser. And when the mouse on the link, it show the pdf file location. This is not what I want.

Is there any method to print the pdf directly? any method, even print using C# is ok.

I found some materials, like window.open and window.print. These methods will prints data appending date and page number, and then somehow is different to the original files. I still not know how view.js work to print that. There seems no other better way to cover this problem. What is the theorem for this subject, how other js developers could create the print function, and can make it as good pdf viewer. Thanks.

我发现printThis可以解决此问题,在chrome中,它可以很好地工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM