mike42 / escpos-php

PHP library for printing to ESC/POS-compatible thermal and impact printers
Other
2.57k stars 863 forks source link

Printing from web #963

Open BonfaceMuoki opened 4 years ago

BonfaceMuoki commented 4 years ago

Hi, I am facing a problem printing from my online server.May kindly help me on this?

Blair2004 commented 4 years ago

Does your printer is connected to the remote server? I guess that's not how you should make it work. This package should (according to me) connected to the computer where the printers are accessible.

Unless I'm missing something.

EwertonDutra commented 4 years ago

Hi,

I think your question is to print directly from the browser of your system users. If so, today with JS it is not easy to do this.

The solutions that exist, I demanded that you install something, on your client's side so that I can have access to the hardware (printer)

Remember that PHP runs on the server, so it doesn't have access to your client's machine.

I already needed this too 👍

mutiemule commented 2 years ago

Printing on local will work well with this package.

However, to print online, you will need to develop a desktop service which has to be installed on the local computer where you need printing to be done. Operating System does not matter in this case, you can be hosting on Linux based server and printing on a windows server. This desktop service interfaces between the online service and the local service.

I resolved this by developing an electron js service based on node-escpos package which can receive commands from the online print command and then communicate those commands to the printer through USB.

You can check out the node-escpos printer driver package for some inspiration on how to go about this.