Skip to content

Commit

Permalink
add updide-down example
Browse files Browse the repository at this point in the history
  • Loading branch information
mike42 committed Feb 24, 2019
1 parent 94d7e6c commit 9bee843
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
16 changes: 16 additions & 0 deletions example/upside-down.php
@@ -0,0 +1,16 @@
<?php
/* Demonstration of upside-down printing */
require __DIR__ . '/../vendor/autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;

$connector = new FilePrintConnector("php://stdout");
$printer = new Printer($connector);

// Most simple example
$printer -> text("Hello\n");
$printer -> setUpsideDown(true);
$printer -> text("World\n");
$printer -> cut();
$printer -> close();

3 changes: 1 addition & 2 deletions src/Mike42/Escpos/Printer.php
Expand Up @@ -966,9 +966,8 @@ public function setUnderline(int $underline = Printer::UNDERLINE_SINGLE)
*
* @param boolean $on True to enable, false to disable.
*/
public function setUpsideDown($on = true)
public function setUpsideDown(bool $on = true)
{
self::validateBoolean($on, __FUNCTION__);
$this -> connector -> write(self::ESC . "{" . ($on ? chr(1) : chr(0)));
}

Expand Down

0 comments on commit 9bee843

Please sign in to comment.