escpos-php
escpos-php copied to clipboard
Please add printer model : Xprinter XP-420B
Use the driver from here. https://www.xprintertech.com/xp-420b-2 Try the code below, its working on my end. Just fixing the alignment and feed options.
use Mike42\Escpos\PrintConnectors\CupsPrintConnector;
try { $connector = new CupsPrintConnector("Xprinter_XP-420B");
$connector->write("WELCOME\n");
$connector->write('THIS IS TEST');
$result = $connector->finalize();
} catch (Exception $e) {
echo "Couldn't print to this printer: " . $e -> getMessage() . "\n";
}