开发者

Autoprint PDF script on php or javascript

开发者 https://www.devze.com 2023-01-13 04:21 出处:网络
I want to build a page that will automatically print a pdf d开发者_如何学Cocument. For example I can call mypage.html?doc=my.pdf and it will print my.pdf file.

I want to build a page that will automatically print a pdf d开发者_如何学Cocument. For example I can call mypage.html?doc=my.pdf and it will print my.pdf file.

How I can do it using javascript or php?

Vladimir


The closest you can get to what you want is to embed an iframe containing the PDF in an HTML page, then call window.print when the iframe has loaded.

...
<iframe src="path/to/file.pdf" onload="window.print()"></iframe>
...

This will open the standard print dialog on most browsers.

0

精彩评论

暂无评论...
验证码 换一张
取 消