Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to print on client printer from server using php

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

like image 783
Shivomkara Chaturvedi Avatar asked Sep 27 '26 01:09

Shivomkara Chaturvedi


2 Answers

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...

like image 117
Quamis Avatar answered Sep 29 '26 14:09

Quamis


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.

like image 44
feeela Avatar answered Sep 29 '26 15:09

feeela



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!