mazinsw/escpos

ESC/POS 打印机库

1.2.1 2023-08-21 21:23 UTC

This package is auto-updated.

Last update: 2024-09-21 23:51:24 UTC


README

用于生成热敏打印机缓冲区的库

Latest Version on Packagist Coverage Status Quality Score Total Downloads

安装

您需要 Composer 来安装此库。

在您的项目文件夹中运行以下命令

composer require mazinsw/escpos

基本示例

<?php
use Thermal\Printer;
use Thermal\Connection\Buffer;
use Thermal\Model;

$model = new Model('MP-4200 TH');
$connection = new Buffer();
$printer = new Printer($model, $connection);
$printer->setColumns(56);
$printer->write('Simple Text *** ');
$printer->writeln('Bold Text', Printer::STYLE_BOLD);
$printer->writeln('Double height', Printer::STYLE_DOUBLE_HEIGHT | Printer::STYLE_BOLD, Printer::ALIGN_CENTER);
$printer->qrcode('qrcode text');
$printer->feed(2);
$printer->buzzer();
$printer->cutter();
$printer->drawer(Printer::DRAWER_1);
echo $connection->getBuffer();
// redirect the output to your printer
// php example.php > COM1

依赖项

  • PHP 8.1 或更高版本
  • Mbstring 扩展

许可证

有关更多信息,请参阅 许可证文件