Ejemplo n.º 1
0
 * arbitrary input from a database, without worrying about encoding it for the printer.
 */
require_once dirname(__FILE__) . "/../Escpos.php";
// Enter connector and capability profile (to match your printer)
$connector = new FilePrintConnector("php://stdout");
$profile = DefaultCapabilityProfile::getInstance();
$verbose = false;
// Skip tables which iconv wont convert to (ie, only print characters available with UTF-8 input)
/* Print a series of receipts containing i18n example strings - Code below shouldn't need changing */
$printer = new Escpos($connector, $profile);
$codePages = $profile->getSupportedCodePages();
$first = true;
// Print larger table for first code-page.
foreach ($codePages as $table => $name) {
    /* Change printer code page */
    $printer->selectCharacterTable(255);
    $printer->selectCharacterTable($table);
    /* Select & print a label for it */
    $label = $name;
    if ($name === false) {
        $label = " (not matched to iconv table)";
    }
    $printer->setEmphasis(true);
    $printer->textRaw("Table {$table}: {$label}\n");
    $printer->setEmphasis(false);
    if ($name === false && !$verbose) {
        continue;
        // Skip non-recognised
    }
    /* Print a table of available characters (first table is larger than subsequent ones */
    if ($first) {