简体   繁体   English

使用javascript打印PDF

[英]Print out PDF with javascript

I have a need to print out multiple PDFs with the help of javascript. 我需要借助javascript打印出多个PDF。 Is this even possible without rendering each PDF in a separate window and calling window.print() ? 甚至无需在单独的窗口中渲染每个PDF并调用window.print()是否有可能?

Basically, I would like to be able to do something like print('my_pdf_url') . 基本上,我希望能够执行类似print('my_pdf_url')

Edit After some searching, I have come to the conclusion that there are no other methods than the one I've described above. 编辑经过一番搜索,我得出的结论是,除了上述方法外,没有其他方法。 It is a far from perfect solution, but it works in simple cases. 这不是一个完美的解决方案,但它在简单的情况下仍然有效。

Edit I ended up merging the PDFs to a monster PDF on the server side and then send this single PDF to the user, who can then choose to print it out. 编辑我最终将PDF合并到服务器端的怪异PDF,然后将此单个PDF发送给用户,然后用户可以选择将其打印出来。

"When it comes to web pages on the internet there is absolutely no way that you can set up a Javascript command to send directly to the default printer." “谈到互联网上的网页,绝对没有办法设置Javascript命令直接发送到默认打印机。”

If you are looking at an intranet/local network vs. internet: "The Internet Explorer substitute for Javascript (called JScript) therefore has slightly more information about the browser and operating system that Javascript itself does. The individual computers on the network running the intranet may be able to be configured to allow the JScript window.print() command write directly to the printer without displaying the print dialog. This configuration would need to be set up individually on each client computer" 如果您正在查看Intranet /本地网络与Internet:“因此,Internet Explorer替代Javascript(称为JScript)具有有关Javascript本身的浏览器和操作系统的更多信息。网络上运行Intranet的各个计算机也许可以配置为允许JScript window.print()命令直接写入打印机而不显示打印对话框。此配置需要在每台客户端计算机上分别进行设置。

http://javascript.about.com/od/events/a/print_3.htm http://javascript.about.com/od/events/a/print_3.htm

printing pdf with javascript is not possible. 无法使用javascript打印pdf。 u can try java.awt.print class for pdf printing. 您可以尝试java.awt.print类进行pdf打印。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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