gblix / weez-zpl
该包的最新版本(0.0.9)没有可用的许可信息。
项目 weez-zpl,从 teddy-dubal/weez-zpl 分支而来。这个版本专注于其维护。
0.0.9
2021-01-07 21:15 UTC
Requires
- php: ^7.3 || ^8
- robgridley/zebra: ^2.0
Requires (Dev)
- fzaninotto/faker: ^1.9.1
- mockery/mockery: ^1.3.1
- phpstan/phpstan: ^0.12.55
- phpunit/phpunit: ^9.4
- squizlabs/php_codesniffer: ^3.5.5
Suggests
- ext-gd: For image processing
README
灵感来源于 w3blogfr/zebra-zpl
此库可以帮助您快速生成适用于 Zebra 打印机的 ZPL 代码。
库仅支持最常见的 ZPL 公共功能(文本,39条码)
目前,库在 Zebra 300 dpi 和原生字体 zebra-0 上进行了测试。
但您始终可以插入原生 ZPL。
如果您使这个库变得更好,您也可以分支此项目并共享代码。
入门
克隆存储库并安装依赖项
$ git clone https://github.com/teddy-dubal/weez-zpl.git $ cd weez-zpl/docker $ docker-compose up $ docker exec -it docker_appzpl_1 bash $ su application $ composer install $ php test.php
$faker = Factory::create(); $fakerImage = $faker->image(null, 150, 150, 'transport', true); //Init Label $zebraLabel = new ZebraLabel(912, 912); $zebraLabel->setDefaultZebraFont(new ZebraFont(ZebraFont::ZEBRA_ZERO)); //Add Text element $zebraLabel->addElement(new ZebraText(10, 84, "Product:", 14)); $zebraLabel->addElement(new ZebraText(395, 84, "Camera", 14)); $zebraLabel->addElement(new ZebraGraficBox(10, 100, 800, 5)); $zebraLabel->addElement(new ZebraText(10, 161, "CA201212AA", 14)); //Add Code Bar 39 $zebraLabel->addElement(new ZebraBarCode39(10, 297, "CA201212AA", 118, 2, 2)); $zebraLabel->addElement(new ZebraText(10, 365, "Qté:", 11)); $zebraLabel->addElement(new ZebraText(180, 365, "3", 11)); $zebraLabel->addElement(new ZebraText(317, 365, "QA", 11)); $zebraLabel->addElement(new ZebraText(10, 520, "Ref log:", 11)); $zebraLabel->addElement(new ZebraText(180, 520, "0035", 11)); $zebraLabel->addElement(new ZebraText(10, 596, "Ref client:", 11)); $zebraLabel->addElement(new ZebraText(180, 599, "1234", 11)); //Add Image from Url $zebraLabel->addElement(new ZebraImage(350, 850, $fakerImage)); //Add Qr Code $zebraLabel->addElement(new ZebraQrCode(350, 297, 'test')); echo $zebraLabel->getZplCode();
原生代码
如果您需要自定义标签
$zebraLabel.addElement(new ZebraNativeZpl("^KD0\n")); /* You can also use usefull fonction ZplUtils.zplCommand to generate a zpl command (with many variables) */ ZplUtils::zplCommand("A", ["0", "R"]); //will return ^A,0,R
Zpl 查看器
http://labelary.com/viewer.html
使用 StackEdit 编写。