qrCode() 공개 메소드

Print the given data as a QR code on the printer.
public qrCode ( string $content, integer $ec = Printer::QR_ECLEVEL_L, integer $size = 3, integer $model = Printer::QR_MODEL_2 )
$content string The content of the code. Numeric data will be more efficiently compacted.
$ec integer Error-correction level to use. One of Printer::QR_ECLEVEL_L (default), Printer::QR_ECLEVEL_M, Printer::QR_ECLEVEL_Q or Printer::QR_ECLEVEL_H. Higher error correction results in a less compact code.
$size integer Pixel size to use. Must be 1-16 (default 3)
$model integer QR code model to use. Must be one of Printer::QR_MODEL_1, Printer::QR_MODEL_2 (default) or Printer::QR_MICRO (not supported by all printers).
예제 #1
0
파일: demo.php 프로젝트: mike42/escpos-php
} 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 = EscposImage::load("resources/escpos-php.png", false);
    $imgModes = array(Printer::IMG_DEFAULT, Printer::IMG_DOUBLE_WIDTH, Printer::IMG_DOUBLE_HEIGHT, Printer::IMG_DOUBLE_WIDTH | Printer::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(Printer::QR_MODEL_1 => "QR Model 1", Printer::QR_MODEL_2 => "QR Model 2 (default)", Printer::QR_MICRO => "Micro QR code\n(not supported on all printers)");
foreach ($models as $model => $name) {
    $printer->qrCode($testStr, Printer::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();