From 6c07d72e2d76c8b8bfa1a50425d77d6585675194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20Kadir=20Ak=C4=B1n?= Date: Tue, 29 Aug 2017 17:10:12 +0300 Subject: [PATCH] release paper function for tm-u295 --- README.md | 4 ++++ src/Mike42/Escpos/Printer.php | 8 ++++++++ test/unit/EscposTest.php | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/README.md b/README.md index ce9ad78e..260b96a4 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ Many thermal receipt printers support ESC/POS to some degree. This driver has be - Epson TM-T20 - Epson TM-T70II - Epson TM-U220 +- Epson TM-U295 (requires `release()` to release slip). - Epson FX-890 (requires `feedForm()` to release paper). - Excelvan HOP-E58 - Excelvan HOP-E200 @@ -320,6 +321,9 @@ Parameters: ### feedForm() Some printers require a form feed to release the paper. On most printers, this command is only useful in page mode, which is not implemented in this driver. +### release() +Some slip printers require release command to release the paper. + ### feedReverse($lines) Print and reverse feed n lines. diff --git a/src/Mike42/Escpos/Printer.php b/src/Mike42/Escpos/Printer.php index 6be19536..ebb68010 100644 --- a/src/Mike42/Escpos/Printer.php +++ b/src/Mike42/Escpos/Printer.php @@ -539,6 +539,14 @@ public function feedForm() $this -> connector -> write(self::FF); } + /** + * Some slip printers require `ESC q` sequence to release the paper. + */ + public function release() + { + $this -> connector -> write(self::ESC . chr(113)); + } + /** * Print and reverse feed n lines. * diff --git a/test/unit/EscposTest.php b/test/unit/EscposTest.php index 186f0f6b..5ac5f263 100644 --- a/test/unit/EscposTest.php +++ b/test/unit/EscposTest.php @@ -980,6 +980,13 @@ public function testFeedForm() $this -> checkOutput("\x1b@\x0c"); } + /* Release */ + public function testRelease() + { + $this -> printer -> release(); + $this -> checkOutput("\x1b@\x1b\x71"); + } + /* Set text size */ public function testSetTextSizeNormal() {