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

How to print from Ubuntu Webserver to Windows 7 Shared Printer

Open r4llproject opened this issue 5 years ago • 5 comments

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

r4llproject avatar Mar 27 '19 02:03 r4llproject

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.

mike42 avatar Mar 27 '19 05:03 mike42

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.

mutiemule avatar Apr 30 '22 09:04 mutiemule

i have same case, any have solve it ?

marwandhiaurrahman avatar Nov 19 '22 07:11 marwandhiaurrahman

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.

mutiemule avatar Nov 19 '22 08:11 mutiemule

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

marwandhiaurrahman avatar Nov 20 '22 10:11 marwandhiaurrahman