如何从浏览器打印 PDF [英] How to print a PDF from the browser

查看:38
本文介绍了如何从浏览器打印 PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Web 应用程序中,是否可以强制在客户端打印 PDF 文件?如果浏览器配置为在窗口内打开 PDF,我猜调用 window.print() 会起作用,但某些浏览器(如我的)配置为从外部打开 PDF.

In a Web application, is it possible to force a PDF file to be printed on the client? If the browser is configured to open the PDF inside the window, I guess that calling window.print() will work, but some browsers (like mine) are configured to open the PDF externally.

推荐答案

google docs 的做法是将 JavaScript 嵌入到 PDF 中,告诉 Acrobat Reader 或任何其他兼容的阅读器进行打印.

The way google docs does it is by embedding JavaScript into the PDF that tells Acrobat Reader or any other compliant reader to print it.

您需要一个 PDF 工具包来处理随机 PDF.

You would need a PDF toolkit to do this with a random PDF.

这篇关于如何从浏览器打印 PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆