RamyTalal / Label-Printer

Easily print labels with a Brother label printer.
MIT License
64 stars 22 forks source link

Qr Size #30

Open arif92 opened 2 years ago

arif92 commented 2 years ago

Hi everyone, i try to print qr code but size is to small any body can help me? i've trying read brother manual https://download.brother.com/welcome/docp100367/cv_ql1100_1110_eng_escp_100.pdf#page=78 but still can't enlarge size of qr code.

semidichia commented 1 year ago

Hi, rewrite the QrCode class as follows

class QrCodeSized implements CommandInterface {
    /**
     * @var string
     * @var int (3-10)
     */
    protected $value;
    protected $size;

    /**
     * @param string $value
     * @param int $size (3-10)
     */
    public function __construct($value, $size)
    {
        $this->value = $value;
        $this->size = $size;
    }

    /**
     * @inheritdoc
     */
    public function read()
    {
        return
            // QR Code Specs; Page 71
            chr(27) .                     // ESC
            'iQ' .
            chr($this->size) .            // Cell size: minimum 3 maximum 10
            chr(2) .                     // Symbol type: 2; (default value)
            chr(0) .                     // Structured Append setting: 0; Not partitioned (default value)
            chr(0) .                     // Code number: 0;
            chr(0) .                     // Number of partitions: 0;
            chr(0) .                     // Parity data: 0;
            chr(2) .                     // Error correction level: 2; Standard level (default value)
            chr(0) .                     // Data input method: 0; Auto input (default value)
            $this->value .                // Barcode data
            chr(92) . chr(92) . chr(92);  // Three backslashes
    }
}

.....
//and then
 $printer->addCommand(new QrCodeSized("now it works",10));