Unofficial Python SDK for the GOOJPRT PT-210 thermal printer (BLE / SPP)
Project description
Unofficial GOOJPRT PT-210 SDK
A Python driver for the 58 mm thermal printer that the vendor forgot to document.
Not affiliated with, endorsed by, or supported by GOOJPRT. Reverse-engineered from packet captures, sweat, and a little bit of thermal paper.
AIDD — AI Driven Development This project was written using AI-assisted development. The architecture, implementation, and documentation were produced through iterative collaboration with AI coding assistants (GitHub Copilot / Claude). Human judgment directed the design; AI did the heavy lifting.
What is this?
The GOOJPRT PT-210 is a compact 58 mm Bluetooth thermal printer sold under various white-label brands. GOOJPRT provides no official SDK, no protocol documentation, and no support for third-party integration. This library fills that gap.
It was created to enable reliable programmatic printing — text, barcodes, QR codes, bitmap images — from Python, without depending on proprietary Android apps or undocumented firmware quirks. The protocol was reverse-engineered from Bluetooth packet captures.
Full documentation: goojprt-pt210-sdk.readthedocs.io
Features
- BLE (Bluetooth Low Energy) — async, cross-platform (macOS, Windows, Linux)
- SPP (classic RFCOMM) — synchronous, Linux only
- Text printing — native ESC/POS code pages or bitmap rendering via Pillow (supports full Unicode and diacritics)
- QR codes — built-in ESC/POS QR generation
- PDF417 barcodes — pure-Python renderer, no native deps
- Image printing — any PIL image, with optional Floyd–Steinberg dithering
- TOML templates — declarative print layouts for receipts, labels, and tickets
- Code-page probe — built-in tool to test which firmware code pages actually work
Installation
There are two variants of the package:
| Variant | What you get | Install extra |
|---|---|---|
| SDK only (default) | goojprt Python package + goojprt CLI |
(none) |
| SDK + Server | everything above + goojprt-server — a FastAPI HTTP print server with live dashboard and REST API |
[server] |
pip
# SDK only
pip install goojprt-pt210-sdk
# SDK + HTTP print server
pip install "goojprt-pt210-sdk[server]"
uv
# SDK only
uv add goojprt-pt210-sdk
# SDK + HTTP print server
uv add "goojprt-pt210-sdk[server]"
Latest from GitHub (development)
# SDK only
pip install git+https://github.com/filipseedy/goojprt-pt210-sdk.git
# SDK + HTTP print server
pip install "git+https://github.com/filipseedy/goojprt-pt210-sdk.git#egg=goojprt-pt210-sdk[server]"
Editable install for local development
git clone https://github.com/filipseedy/goojprt-pt210-sdk.git
cd goojprt-pt210-sdk
# SDK only
pip install -e .
# SDK + HTTP print server
pip install -e ".[server]"
Requirements: Python 3.14+. Core dependencies (bleak, Pillow, pdf417) are installed automatically. The [server] extra adds FastAPI, Uvicorn, Jinja2, Rich, and Pydantic.
Quick start
import asyncio
from goojprt import GoojPrtPT210
async def main() -> None:
printer = GoojPrtPT210()
await printer.connect_ble("XX:XX:XX:XX:XX:XX")
await printer.initialize()
await printer.print_text("Hello, world!")
await printer.feed(3)
await printer.disconnect()
asyncio.run(main())
Print bitmap text (full Unicode / diacritics)
await printer.print_text_image(
"Příliš žluťoučký kůň\núpěl ďábelské ódy",
font_size=28,
)
Print a QR code
await printer.print_qr("https://example.com", size=5)
Print a PDF417 barcode
await printer.print_pdf417("1234567890ABCDEF", columns=5, scale=2)
CLI
# BLE demo print
goojprt XX:XX:XX:XX:XX:XX
# Bitmap text with antialiasing
goojprt XX:XX:XX:XX:XX:XX --print-image "Příliš žluťoučký kůň"
# PDF417 barcode
goojprt XX:XX:XX:XX:XX:XX --pdf417 "data"
# Print from a TOML template
goojprt XX:XX:XX:XX:XX:XX --template receipt.toml --var name=John
# Probe which code pages actually work on your unit
goojprt XX:XX:XX:XX:XX:XX --test
Run goojprt --help for all options.
Two text paths
| Path | Method | Diacritics | Speed |
|---|---|---|---|
| Native ESC/POS | print_text |
Depends on firmware | Fast |
| Bitmap (Pillow) | print_text_image |
Always correct | Slower |
If diacritics appear as garbage, switch to print_text_image. Use --test (or probe_charsets()) to test your specific unit.
TOML templates
Define a print layout in a .toml file:
[[items]]
type = "text"
text = "Receipt — {{date}}"
bold = true
align = "center"
[[items]]
type = "qr"
data = "https://example.com/{{order_id}}"
[[items]]
type = "feed"
lines = 4
Variables like {{date}}, {{time}}, {{expiry_7d}} are built-in. Pass custom variables with --var KEY=VALUE.
Documentation
Full API reference, architecture notes, and examples are at:
goojprt-pt210-sdk.readthedocs.io
License
MIT. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file goojprt_pt210_sdk-0.1.2.tar.gz.
File metadata
- Download URL: goojprt_pt210_sdk-0.1.2.tar.gz
- Upload date:
- Size: 132.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b70bc572603be0195af58bcf912cf942b0fbef0fb912e9d6f156f91561201ea
|
|
| MD5 |
83131ed26e558b2fa6dc03b3016f176e
|
|
| BLAKE2b-256 |
a41f0177baaae2ac35faa2c317eddd4c4acf47b5be1d5680205f91439bcae243
|
Provenance
The following attestation bundles were made for goojprt_pt210_sdk-0.1.2.tar.gz:
Publisher:
publish.yml on filipsedivy/goojprt-pt210-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goojprt_pt210_sdk-0.1.2.tar.gz -
Subject digest:
5b70bc572603be0195af58bcf912cf942b0fbef0fb912e9d6f156f91561201ea - Sigstore transparency entry: 1340628215
- Sigstore integration time:
-
Permalink:
filipsedivy/goojprt-pt210-sdk@3511edbc6d13ddf774d9756a61e9619f7c126259 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/filipsedivy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3511edbc6d13ddf774d9756a61e9619f7c126259 -
Trigger Event:
push
-
Statement type:
File details
Details for the file goojprt_pt210_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: goojprt_pt210_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 77.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53807de5db2ea75d096a1e4878ccc71ee29273caed1872fc0f3fc67bfd8bcf65
|
|
| MD5 |
a8fbd16b2732d0284b09b1f1499e8b3f
|
|
| BLAKE2b-256 |
9751aa6e23b9428600c8a7c76e024a05b894bc8a6b3eb5a41d27392c1df2aa3f
|
Provenance
The following attestation bundles were made for goojprt_pt210_sdk-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on filipsedivy/goojprt-pt210-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goojprt_pt210_sdk-0.1.2-py3-none-any.whl -
Subject digest:
53807de5db2ea75d096a1e4878ccc71ee29273caed1872fc0f3fc67bfd8bcf65 - Sigstore transparency entry: 1340628219
- Sigstore integration time:
-
Permalink:
filipsedivy/goojprt-pt210-sdk@3511edbc6d13ddf774d9756a61e9619f7c126259 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/filipsedivy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3511edbc6d13ddf774d9756a61e9619f7c126259 -
Trigger Event:
push
-
Statement type: