mike42 / escpos-php

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

How to print from Ubuntu Webserver to Windows 7 Shared Printer #722

Open r4llproject opened 5 years ago

r4llproject commented 5 years ago

Dear Mike, I have Xampp with laravel installed from Ubuntu 18.04 as web server, I also have installed Epson TM-82 in windows 7. my script : $connector = new WindowsPrintConnector("smb://172.17.4.98/prtimbangan");

error result : preg_match(): Compilation failed: invalid range in character class at offset 29

error file : /opt/lampp/htdocs/ess3/vendor/mike42/escpos-php/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php

on line : $this -> printerName = $dest; } elseif (preg_match(self::REGEX_SMB, $dest) == 1) { // Connect to samba share, eg smb://host/printer $part = parse_url($dest);

Is there any solution to my problem? Thanks for your help..

mike42 commented 5 years ago

Hi there,

There was an issue with escpos-php versions before 2.1, where the WindowsPrintConnector contained a regex which was not valid in PHP 7.3.

Wich PHP and escpos-php versions you are using? You may be seeing the same issue.

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, which can receive commands from the online print command and then communicate those commands to the printer through USB.

marwandhiaurrahman commented 1 year ago

i have same case, any have solve it ?

mutiemule commented 1 year ago

i have same case, any have solve it ?

I created an electron desktop app which communicates directly with the online API for printing. So, it receives the communication request from the online API then issues the command to the printer locally.

marwandhiaurrahman commented 1 year ago

yahh, this is very tricky, it turns out that there are many other ways according to each condition