mike42 / escpos-php

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

“web-based point-of-sale (POS) applications” - How? #1001

Closed c-myers1 closed 3 years ago

c-myers1 commented 3 years ago

With respect to “... support for receipt printing to any PHP app, including web-based point-of-sale (POS) applications,”: how exactly is this achieved with escpos-php (for a Linux server php app to print on a local windows printer?) Is this automatic with smb set up?

c-myers1 commented 3 years ago

Ok, a pretty vexed issue as described in this FAQ.

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

Check the FAQs on how to print online to have some pointers too.