how to print on client printer from server using php

喜你入骨 提交于 2020-01-01 15:36:14

问题


I want to print a pdf file(pdf file is on server) using php (php is also running on server) on client computer.

How can I do this.

Thanks in advance for you help


回答1:


You cannot do this directly, as the php/apache server runs on a completely different computer(and maybe geographic location) than the browser/client.

You can however use intermediate solutions, like

  • proprietary, custom applications installed on the client's computer that "talks" to the server and requests files to be printed. These should be cross-platform in some way or another
  • browser addons, separate addon for every possible browser, if it can support addons:)
  • special "pdf" viewers, that cannot actually view, but only prints pdf's, installed on the client's computer.
  • the server connects to the clients computers printer(the client has to share the printer first though) and tries to print through it

All these are just ugly hacks, used in conjunction with a badly designed application/workflow in that application, so be very carefull if you really want this...




回答2:


As the PHP-printer methods are only available on Win-systems, you should use the methods, which are provided for printing by the underlying OS (e.g. some Liunx distro) and call the accordant shell-commands from PHP.




回答3:


But of course you can!!!

What I would do is to open up the page in the client's browser and have javascript prompt the user to print the document out. hope this helps



来源:https://stackoverflow.com/questions/7242535/how-to-print-on-client-printer-from-server-using-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!