Install
openclaw skills install @yardfarmer/gprinterControl and print text, barcodes, and QR codes on the Gprinter GP-C200V ESC/POS thermal printer via Node.js or command line.
openclaw skills install @yardfarmer/gprinter佳博 (Gainscha) GP-C200V ESC/POS 热敏打印机开发技能包。
skill/
├── CLAUDE.md # 技能主文档 — 架构、规则、命令速查
├── esc-pos-protocol.md # ESC/POS 协议完整参考
├── print-helper.js # Node.js 可复用打印库
├── print-standalone.js # 命令行打印工具
└── README.md # 本文件
const GPPrinter = require('./print-helper');
const printer = new GPPrinter({
host: '192.168.50.189',
port: 9100,
});
await printer.connect();
// 打印文本
const cmd = printer.buildTextCommand('Hello 世界', {
align: 'center',
size: 'double',
cut: true,
});
await printer.sendRaw(cmd);
await printer.disconnect();
# 打印文本
node print-standalone.js --text "Hello World 中文测试"
# 打印文件
node print-standalone.js --file receipt.txt
# 打印二维码
node print-standalone.js --qr "https://example.com"
# 打印条形码
node print-standalone.js --barcode CODE128 "TEST-001"
# 打印后切纸
node print-standalone.js --text "Hello" --cut
# 指定打印机
node print-standalone.js --host 192.168.1.100 --text "Test"
可选,仅在需要浏览器打印时使用。需要启动
h5-usb-serial/项目中的server.js作为 TCP 桥接。打开http://localhost:3000/gp-c200v.html。
encodeToGb2312 映射表不完整ESC J 0xFF + ESC igpESC.createNew().setText()| 参数 | 值 | 说明 |
|---|---|---|
| 打印机 IP | 192.168.50.189 | WiFi 地址 |
| 端口 | 9100 | RAW 打印端口 |
| 打印宽度 | 384px | 80mm 纸满宽 |
| 每行字符 | 42(标准) / 21(双倍) | 字符容量 |