escpos-php
escpos-php copied to clipboard
ERROR is WHEN you Put it ON the WEB
HELLO FRIENDS, I AM USING AN EPSON TM-T20, WITH THE FOLLOWING SETTINGS:
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector; use Mike42\Escpos\Printer;
try { $connector = new WindowsPrintConnector("TM-20"); $printer = new Printer($connector); $printer -> text("-----------------------------------------------\n"); $printer -> text(" COMPROVANTE DE PAGAMENTO \n"); $printer -> text("-----------------------------------------------\n"); $printer -> text("PAGO EM:".$data_pagamento."\n\n"); \n"); $printer -> text("-----------------------------------------------\n"); $printer -> cut(); $printer -> close(); } catch (Exception $e) { echo "Couldn't print to this printer: " . $e -> getMessage() . "\n"; }
It is perfectly working in local with XAMPP, on THE PRINT-OUT AUTOMATICALLY. But when I do, I do the update on the web server (hostgator) and online doesn't work, can anyone help me with rewriting the ai code for me....
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.