feedReverse() 공개 메소드

Print and reverse feed n lines.
public feedReverse ( integer $lines = 1 )
$lines integer number of lines to feed. If not specified, 1 line will be fed.
예제 #1
0
파일: demo.php 프로젝트: mike42/escpos-php
require __DIR__ . '/../autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\EscposImage;
$connector = new FilePrintConnector("php://stdout");
$printer = new Printer($connector);
/* Initialize */
$printer->initialize();
/* Text */
$printer->text("Hello world\n");
$printer->cut();
/* Line feeds */
$printer->text("ABC");
$printer->feed(7);
$printer->text("DEF");
$printer->feedReverse(3);
$printer->text("GHI");
$printer->feed();
$printer->cut();
/* Font modes */
$modes = array(Printer::MODE_FONT_B, Printer::MODE_EMPHASIZED, Printer::MODE_DOUBLE_HEIGHT, Printer::MODE_DOUBLE_WIDTH, Printer::MODE_UNDERLINE);
for ($i = 0; $i < pow(2, count($modes)); $i++) {
    $bits = str_pad(decbin($i), count($modes), "0", STR_PAD_LEFT);
    $mode = 0;
    for ($j = 0; $j < strlen($bits); $j++) {
        if (substr($bits, $j, 1) == "1") {
            $mode |= $modes[$j];
        }
    }
    $printer->selectPrintMode($mode);
    $printer->text("ABCDEFGHIJabcdefghijk\n");