mike42 / escpos-php

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

Send commad through webservice #1075

Open abhinavrazz7272 opened 3 years ago

abhinavrazz7272 commented 3 years ago

Hi ,

I have developed an android app which is connected to ESC/POS printer

I want to send the commamds from web service which will handle in app and print the receipt.

I want to mange the data from backend so that I can change print data whenever I want.

Thank you

abhinavrazz7272 commented 3 years ago

Please help me guys. I am stuck

mutiemule commented 2 years ago

Printing on local will work well with this package.

However, to print from 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. This is because PHP is a server-side scripting language, so once you put this online, it won't be able to communicate to the local printer. Thus, you need a client service running on the local machine and this is where electron js and node js come into play.

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.

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.

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

For your case you can connect the printer to BlueTooth then import the node package on your android project.