escpos-php icon indicating copy to clipboard operation
escpos-php copied to clipboard

Working on webapp in linux server and connecting to windows local USB serial port

Open freemartian opened this issue 2 years ago • 1 comments

When I try to connect to my web app from a Linux server, it says the port is not available. When I run ls -l /dev/tty* I am getting this list.

image

When I try to run stty -F /dev/ttyS0 its showing the result

image

but when I run stty -F /dev/ttyUSB0 I am getting image

Does anyone knows how to solve this, I am trying this for the last 5 days.

freemartian avatar Jan 16 '22 06:01 freemartian

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

mutiemule avatar Apr 30 '22 10:04 mutiemule