dbr/ezpl

此包的最新版本(dev-master)没有可用的许可信息。

热敏标签打印机 EZPL 命令生成器

维护者

详细信息

github.com/DBRisinajumi/ezpl

源代码

安装: 52

依赖: 1

建议: 0

安全: 0

星标: 0

关注者: 1

分支: 7

dev-master 2022-01-03 20:07 UTC

This package is auto-updated.

Last update: 2024-08-29 05:44:20 UTC


README

EZPL 命令生成器,用于标签热敏打印机。此库适用于希望直接与打印机集成而无需任何第三方应用的任何人。

此库已在 Godex G500 模型和 50mmx45mm 标签标签纸上进行了测试。

安装

composer require fashionvalet/stickie

生成 EZPL 命令

<?php

use Dbr\Ezpl\Builder;
use Dbr\Ezpl\CommandPipe;

$command = (new Builder(new CommandPipe))
    ->resetMemory()
    ->setLabelWidth(50)
    ->setLabelHeight(30)
    ->setDensity(10)
    ->copies(1)
    ->labelStart()
    ->text(10, 15, 5, 1, 1, 0, 0, 'Item: Brina Flowy Chiffon Skirt - UK 6')
    ->text(10, 15, 30, 1, 1, 0, 0, 'Brand: Aere')
    ->text(10, 15, 90, 1, 1, 0, 0, 'SKU: 1504051610-UK 6')
    ->text(10, 15, 120, 1, 1, 0, 0, 'Price: RM 1,000.00')
    ->barcode('CODE128', 72, 160, 2, 10, 30, 0, 3, 'AR0009287')
    ->labelEnd()
    ->compose();

这将生成以下 EZPL 输出

~MDEL\n
^W50\n
^Q30\n
^H10\n
^P1\n
^L\n
AB, 15, 5, 1, 1, 0, 0, Item: Brina Flowy Chiffon Skirt - UK 6\n
AB, 15, 60, 1, 1, 0, 0, Brand: Aere\n
AB, 15, 90, 1, 1, 0, 0, SKU: 1504051610-UK 6\n
AB, 15, 120, 1, 1, 0, 0, Price: RM 1,000.00\n
BQ, 72, 160, 2, 10, 30, 0, 3,AR0009287\n
E\n

打印输出

<?php

use Dbr\Ezpl\Printer;
use Dbr\Ezpl\Builder;
use Dbr\Ezpl\CommandPipe;
use Dbr\Ezpl\Driver\LinuxConnector;

$command = (new Builder(new CommandPipe))
    ->resetMemory()
    ->setLabelWidth(50)
    ->setLabelHeight(30)
    ->setDensity(10)
    ->copies(1)
    ->labelStart()
    ->text(10, 15, 5, 1, 1, 0, 0, 'Item: Brina Flowy Chiffon Skirt - UK 6')
    ->text(10, 15, 30, 1, 1, 0, 0, 'Brand: Aere')
    ->text(10, 15, 90, 1, 1, 0, 0, 'SKU: 1504051610-UK 6')
    ->text(10, 15, 120, 1, 1, 0, 0, 'Price: RM 1,000.00')
    ->barcode('CODE128', 72, 160, 2, 10, 30, 0, 3, 'AR0009287')
    ->labelEnd();

$connector = new LinuxConnector('/dev/usb/lp0');
$printer = new Printer($connector, $command);

$printer->generate();

##备注

  • GODEX G500 分辨率为 8 点/毫米