I recently deployed an Epson TM-U220 impact receipt printer. These printers work by striking a ribbon onto the paper, like a type-writer. One of the up-sides to using these intead of a thermal printer is the ability to install a red/black ribbon in place of the default (black) one:
I connected up my printer using a USB-parallel cable, so my previous posts (Linux, Windows) apply for the connector setup.
Using the escpos-php driver on GitHub, a line of red text is printed like this:
<?php
/*
* Example of two-color printing, tested on an epson TM-U220 with two-color ribbon installed.
*/
require __DIR__ . '/autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
$connector = new FilePrintConnector("php://stdout");
$printer = new Printer($connector);
try {
$printer = new Escpos($connector);
$printer -> text("Hello World!\n");
$printer -> setColor(Printer::COLOR_2);
$printer -> text("Red?!\n");
$printer -> setColor(Printer::COLOR_1);
$printer -> text("Default color again?!\n");
$printer -> cut();
} finally {
/* Always close the printer! */
$printer -> close();
}
With this result: