使用 php 或 javascript 打开和打印 PDF
我想编写一个函数,它接受 url 作为参数,然后它会打印 pdf...我该怎么做?
我应该使用 php 打开文件,然后使用 javascript 打印它吗?
感谢您的帮助
I want to write a function that takes a url as an argument and then it goes and prints the pdf... how can i do that?
should i open the file using php and then print it using javascript?
Thanks for the help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 PHP header() 函数。
尝试看看这里:
http://www.w3schools.com/php/func_http_header.asp
http://php.net/manual/en/function.header.php
You can use PHP header() function.
Try look here:
http://www.w3schools.com/php/func_http_header.asp
http://php.net/manual/en/function.header.php
PHP 和 javascript 通常用于生成网页 - 服务器和客户端上都没有直接打印链接。即使在有意义的上下文中,这两种语言都没有打印 API,因此您需要使用操作系统或其他工具中的设施 - 并且您也没有提供有关此的详细信息。
PHP在哪里运行? JavaScript 在哪里运行?您希望在哪里打印 PDF(客户端/服务器)?最后应该进行打印的操作系统正在运行什么?
PHP and javascript are usually used for generating web pages - there is no direct link to printing on either the server nor the client. Even in contexts where this would make sense, there is no printing API in either language so you'd need to use the facilities within the OS or another tool - and you've provided no details about this either.
Where is the PHP running? Where is the Javascript running? Where do you want the PDF printed (client/server)? What OS is running at the end where printing should happen?