initialize() public method

Initialize printer. This resets formatting back to the defaults.
public initialize ( )
Ejemplo n.º 1
0
<?php

/**
 * This print-out shows how large the available font sizes are. It is included
 * separately due to the amount of text it prints.
 *
 * @author Michael Billington <*****@*****.**>
 */
require __DIR__ . '/../autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
$connector = new FilePrintConnector("php://stdout");
$printer = new Printer($connector);
/* Initialize */
$printer->initialize();
/* Text of various (in-proportion) sizes */
title($printer, "Change height & width\n");
for ($i = 1; $i <= 8; $i++) {
    $printer->setTextSize($i, $i);
    $printer->text($i);
}
$printer->text("\n");
/* Width changing only */
title($printer, "Change width only (height=4):\n");
for ($i = 1; $i <= 8; $i++) {
    $printer->setTextSize($i, 4);
    $printer->text($i);
}
$printer->text("\n");
/* Height changing only */
title($printer, "Change height only (width=4):\n");