<?php

require_once dirname(__FILE__) . "/../../Escpos.php";
/* This example shows the printing of Latvian text on the Star TUP 592 printer */
$profile = StarCapabilityProfile::getInstance();
/* Option 1: Native character encoding */
$connector = new FilePrintConnector("php://stdout");
$printer = new Escpos($connector, $profile);
$printer->text("Glāžšķūņa rūķīši dzērumā čiepj Baha koncertflīģeļu vākus\n");
$printer->cut();
$printer->close();
/* Option 2: Image-based output (formatting not available using this output) */
$buffer = new ImagePrintBuffer();
$connector = new FilePrintConnector("php://stdout");
$printer = new Escpos($connector, $profile);
$printer->setPrintBuffer($buffer);
$printer->text("Glāžšķūņa rūķīši dzērumā čiepj Baha koncertflīģeļu vākus\n");
$printer->cut();
$printer->close();
try {
    // Enter connector and capability profile
    $connector = new FilePrintConnector("php://stdout");
    $profile = DefaultCapabilityProfile::getInstance();
    $buffers = array(new EscposPrintBuffer(), new ImagePrintBuffer());
    /* Print a series of receipts containing i18n example strings */
    $printer = new Escpos($connector, $profile);
    $printer->selectPrintMode(Escpos::MODE_DOUBLE_HEIGHT | Escpos::MODE_EMPHASIZED | Escpos::MODE_DOUBLE_WIDTH);
    $printer->text("Implemented languages\n");
    $printer->selectPrintMode();
    foreach ($inputsOk as $label => $str) {
        $printer->setEmphasis(true);
        $printer->text($label . ":\n");
        $printer->setEmphasis(false);
        foreach ($buffers as $buffer) {
            $printer->setPrintBuffer($buffer);
            $printer->text($str);
        }
        $printer->setPrintBuffer($buffers[0]);
    }
    $printer->feed();
    $printer->selectPrintMode(Escpos::MODE_DOUBLE_HEIGHT | Escpos::MODE_EMPHASIZED | Escpos::MODE_DOUBLE_WIDTH);
    $printer->text("Works in progress\n");
    $printer->selectPrintMode();
    foreach ($inputsNotOk as $label => $str) {
        $printer->setEmphasis(true);
        $printer->text($label . ":\n");
        $printer->setEmphasis(false);
        foreach ($buffers as $buffer) {
            $printer->setPrintBuffer($buffer);
            $printer->text($str);