} catch (Exception $e) { /* Images not supported on your PHP, or image file not found */ $printer->text($e->getMessage() . "\n"); } $printer->cut(); /* Bit image */ try { $logo = new EscposImage("resources/escpos-php.png"); $imgModes = array(Escpos::IMG_DEFAULT, Escpos::IMG_DOUBLE_WIDTH, Escpos::IMG_DOUBLE_HEIGHT, Escpos::IMG_DOUBLE_WIDTH | Escpos::IMG_DOUBLE_HEIGHT); foreach ($imgModes as $mode) { $printer->bitImage($logo, $mode); } } catch (Exception $e) { /* Images not supported on your PHP, or image file not found */ $printer->text($e->getMessage() . "\n"); } $printer->cut(); /* QR Code - see also the more in-depth demo at qr-code.php */ $testStr = "Testing 123"; $models = array(Escpos::QR_MODEL_1 => "QR Model 1", Escpos::QR_MODEL_2 => "QR Model 2 (default)", Escpos::QR_MICRO => "Micro QR code\n(not supported on all printers)"); foreach ($models as $model => $name) { $printer->qrCode($testStr, Escpos::QR_ECLEVEL_L, 3, $model); $printer->text("{$name}\n"); $printer->feed(); } $printer->cut(); /* Pulse */ $printer->pulse(); /* Always close the printer! On some PrintConnectors, no actual * data is sent until the printer is closed. */ $printer->close();