← Back to Skills Marketplace
yardfarmer

Gprinter

by yardfarmer · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
102
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install gprinter
Description
Control and print text, barcodes, and QR codes on the Gprinter GP-C200V ESC/POS thermal printer via Node.js or command line.
README (SKILL.md)

GP-C200V Printer Skill

佳博 (Gainscha) GP-C200V ESC/POS 热敏打印机开发技能包。

文件结构

skill/
├── CLAUDE.md              # 技能主文档 — 架构、规则、命令速查
├── esc-pos-protocol.md    # ESC/POS 协议完整参考
├── print-helper.js        # Node.js 可复用打印库
├── print-standalone.js    # 命令行打印工具
└── README.md              # 本文件

快速使用

1. 使用 Node.js 库打印

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();

2. 命令行打印

# 打印文本
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"

3. 浏览器测试页

可选,仅在需要浏览器打印时使用。需要启动 h5-usb-serial/ 项目中的 server.js 作为 TCP 桥接。打开 http://localhost:3000/gp-c200v.html

核心规则

  1. 中文必须用 GBK 编码encodeToGb2312 映射表不完整
  2. 切纸前必须走纸ESC J 0xFF + ESC i
  3. 使用原始字节数组 — 不要用 gpESC.createNew().setText()

关键参数

参数 说明
打印机 IP 192.168.50.189 WiFi 地址
端口 9100 RAW 打印端口
打印宽度 384px 80mm 纸满宽
每行字符 42(标准) / 21(双倍) 字符容量
Usage Guidance
This skill appears to be what it says: a Node.js/CLI helper for sending ESC/POS byte commands to a GP‑C200V printer. Before installing/running: - Be aware it will open TCP connections to the configured printer IP/port (default 192.168.50.189:9100). Only run it in networks where that traffic is expected. - The library has an optional HTTP bridge mode that POSTs command arrays to http://localhost:3000/send. That only matters if you run a local bridge; do not enable/start unknown services unless you understand them. - No environment variables or secrets are required. The CLI can read any local file path you supply via --file (expected behavior) — avoid passing sensitive file paths to it. - Operational notes: package.json lists iconv-lite but there is no install script; ensure your environment has Node and dependencies installed. There are minor code bugs (inconsistent socket.connect argument order and reliance on global fetch in sendViaBridge) that may prevent the scripts from working without small fixes. If you trust the source and only intend to print to a known printer IP or use the local bridge intentionally, this skill is reasonably proportionate. If you do not trust the package source, review and run the contained JS files in a controlled environment first.
Capability Analysis
Type: OpenClaw Skill Name: gprinter Version: 1.0.0 The skill bundle is a legitimate implementation for controlling a Gainscha GP-C200V thermal printer via the ESC/POS protocol. It includes a Node.js library (print-helper.js) and a CLI tool (print-standalone.js) that handle TCP communication, GBK encoding for Chinese text, and command generation for barcodes and QR codes. While the CLI tool can read local files for printing, this is a standard feature for its stated purpose, and no evidence of malicious intent, data exfiltration, or prompt injection was found.
Capability Tags
crypto
Capability Assessment
Purpose & Capability
Name/description (GP‑C200V printer helper) matches what the files do: building ESC/POS byte arrays and sending them over raw TCP or via an optional local HTTP bridge. Declared dependencies (iconv-lite) and the use of net/fetch are appropriate for encoding GBK and sending bytes to a network printer. No unrelated credentials, binaries, or config paths are requested.
Instruction Scope
SKILL.md and the scripts only instruct building ESC/POS commands, connecting to a printer IP:port, and (optionally) using a local HTTP bridge. The CLI can read a user-specified file (expected functionality). The helper contains an optional sendViaBridge() that POSTs to http://localhost:3000/send (used only if caller chooses it). Nothing in the instructions attempts to read other system secrets or external endpoints beyond the printer or local bridge. There are small implementation bugs/inconsistencies (e.g., inconsistent socket.connect argument order in different files) which may break runtime behavior but are not evidence of malicious intent.
Install Mechanism
This is instruction-only (no install spec). The package.json/package-lock declare a single dependency (iconv-lite) and package-lock points to an npm mirror — normal for Node projects. Because there is no install spec, the environment running these scripts must already provide Node and the dependency; the omission is an operational inconsistency (not a security issue) worth noting.
Credentials
The skill requests no environment variables or credentials. Network targets are limited to the configured printer IP/port (defaults to 192.168.50.189:9100) and an optional local bridge (localhost:3000). These are proportional to the printer use case. No secret-exfiltration vectors are declared or present.
Persistence & Privilege
The skill does not request permanent presence (always:false) and does not attempt to modify other skills or system-wide config. It performs network I/O only when its functions are called.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install gprinter
  3. After installation, invoke the skill by name or use /gprinter
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release: GP-C200V ESC/POS thermal printer skill with GBK Chinese text support
Metadata
Slug gprinter
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Gprinter?

Control and print text, barcodes, and QR codes on the Gprinter GP-C200V ESC/POS thermal printer via Node.js or command line. It is an AI Agent Skill for Claude Code / OpenClaw, with 102 downloads so far.

How do I install Gprinter?

Run "/install gprinter" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Gprinter free?

Yes, Gprinter is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Gprinter support?

Gprinter is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Gprinter?

It is built and maintained by yardfarmer (@yardfarmer); the current version is v1.0.0.

💬 Comments