escpos-php
escpos-php copied to clipboard
Find a way to print to a local printer from the cloud
I really like this project, but for me the most important problem is not being able to print from the cloud. I propose develop a way that could print from the cloud. I am developer and I can help with this. Some ideas:
- Develop local application similar to QZ Print or TakePOS Connector (I am experienced in this last one)
- Develop Chrome extension
- Simple mike42 local installation that connects to the cloud installation.
What do you think? Do you have other idea?
A lot has been written on the issue tracker about this over the years. Have you seen the FAQ entry "Can I print from my server on the Internet?". It mentions some of these suggestions.
The challenge, as you seem to have noticed, is that you need extra components to help you with data transport. Since developers each have different hardware/software linked up over their network (and often do not control one or more of these components), what works for you will not work for everybody.
From our project's perspective, it's easy enough to use CupsPrintConnector
, WindowsPrintConnector
or NetworkPrintConnector
on the LAN. You can combine this with a secure tunnel (eg. VPN a Raspberry Pi that is deployed near the printer to a server in your cloud environment) to extend your LAN if you are familiar enough with the tools involved, or you can deploy a secured print service to pass on the print jobs (eg. you can use the Internet Printing Protocol with the CupsPrintConnector
).
The alternative is to use DummyPrintConnector
to get the binary print data and return it to the client as part of the HTTP request, which will require you to have something running client-side to pick it up. Software in this space is often either proprietary or has commercial support.
I'm open to suggestions which can improve the developer experience in order to reduce the burden of transport-related issues on the issue tracker. In the past week, I've opened up the wiki for this project, and started labeling these problems on the issue tracker. I'm also considering spinning off all transport-related code to a separate project in the medium-term, so that we can share this effort with other (non-ESC/POS) printing projects.
Good afternoon, is there any solution for this problem. I'm trying to print from the cloud and haven't been able to yet. Please help
Example here https://github.com/mike42/escpos-php/issues/988
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.