mike42 / escpos-php

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

So I found a solution for my project, I added this function to the Printer.php program : #1223

Open caleb98kymez opened 1 year ago

caleb98kymez commented 1 year ago
    So I found a solution for my project, I added this function to the Printer.php program :

public function selectDisplay(int $disp = 1) { self::validateInteger($disp, 0, 3, __FUNCTION__); $this->connector->write ( self::ESC . "=" . chr ($disp) ); }

And in my php script that print the receipt I did like this :

include("../inc/Escpos/autoload.php"); try { $connector = new RawbtPrintConnector(); $printer = new Printer($connector, null, 1); $printer->selectDisplay(2); $printer->text("Affichage\n"); $printer->selectDisplay(1); $printer->text("Imprimante\n"); } catch (Exception $e) { echo $e->getMessage(); } finally { $printer->close(); }

And finaly in my main page I have a little JS code that request my receipt.php and redirect the browser with the data sended by the receipt.php, and it works !!!

Thanks a lot to this project, @mike42 for the escpos-php and @Muraveiko for the rawbt stuff !!! 👍

Originally posted by @MikeMP76 in https://github.com/mike42/escpos-php/issues/1031#issuecomment-771708635

caleb98kymez commented 1 year ago

So, I used the Printer PHP code to try and display some characters on an LCD 20-character 2-line customer display but it only showed single strokes with no apparent readable data. I was trying to display some data on the ZKBIO850 POS machine. It has a customer display integrated into the machine. I found out that the communication is happening through a COM2 port. Please help