简体   繁体   English

PHP输出PDF和打印页面

[英]PHP output PDF and print page

I have a script generating PDFs via PHP and I can output the results directly to the browser. 我有一个通过PHP生成PDF的脚本,我可以将结果直接输出到浏览器。 Is there a way through PHP and possibly headers to make this output page automatically bring up the print dialog? 有没有一种方法可以通过PHP和可能的标题使此输出页面自动显示打印对话框?

You can execute embeded JavaScript in a PHP document that gets executed when the PDF is opened. 您可以在打开PDF时执行的PHP文档中执行嵌入的JavaScript。 So, you could embed a print(); 因此,您可以嵌入print(); command to open the print dialog as soon as the PDF is opened. 打开PDF时立即打开打印对话框的命令。

I'm not sure how you're creating the PDF, but you could take a look at the suggestions HERE and see if that helps. 我不确定您如何创建PDF,但是您可以在此处查看建议,看看是否有帮助。

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

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