在php或javascript上自动生成PDF脚本

时间:2022-10-30 21:55:26

I want to build a page that will automatically print a pdf document. For example I can call mypage.html?doc=my.pdf and it will print my.pdf file.

我想建立一个自动打印pdf文档的页面。例如,我可以调用mypage.html?doc=my。它会打印我的。pdf文件。

How I can do it using javascript or php?

我如何使用javascript或php来实现它?

Vladimir

弗拉基米尔•

1 个解决方案

#1


3  

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.

最接近您想要的是在HTML页面中嵌入包含PDF的iframe,然后调用window。当iframe已加载时打印。

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

This will open the standard print dialog on most browsers.

这将在大多数浏览器上打开标准打印对话框。

#1


3  

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.

最接近您想要的是在HTML页面中嵌入包含PDF的iframe,然后调用window。当iframe已加载时打印。

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

This will open the standard print dialog on most browsers.

这将在大多数浏览器上打开标准打印对话框。