Local image and text label printing for U1 thermal printers: configurable layouts, continuous batches, and durable job receipts.
Español · User manual · Agent integration · Compatibility
TinyLabel turns images and configurable text into monochrome label plans and sends them through a single Bluetooth session. It includes a Python async API, a JSON CLI, previews, persistent duplicate-job protection, flow control, and explicit operator confirmation.
New in 0.2.0: text blocks, regular/bold fonts, wrapping, alignment, optional size reduction, external fields and JSON text jobs. Your application can read Excel and compose strings externally; the SDK does not import spreadsheets. Read the text manual.
Release status: experimental / alpha. The adapter targets U1 over Bluetooth Classic/SPP, with a 384-dot print head. On one U1/Windows setup, the operator accepted single text/logo proofs and five consecutive mixed labels, using 50 × 25 mm media, a 2 mm gap and darkness 5/5. Logo/field composition happened in the host application. Longer runs, other sizes and final roll origin remain unverified. Successful sends return transmitted_unconfirmed until physical observations are recorded. See hardware evidence, including earlier incidents.
Python 3.10 or newer and a Bluetooth Classic adapter are required for printing. Windows is the primary target. Download a wheel from Releases, then:
python -m pip install .\tinylabel_sdk-0.2.0-py3-none-any.whlOr install the pinned source release:
python -m pip install "git+https://github.com/cescodevadmin00/[email protected]"This project is not currently distributed through PyPI. To develop locally, clone the repository and run python -m pip install -e ..
From a repository checkout, with your own label.png:
tinylabel preview label.png --profile profiles/u1_50x25_gap2.json --out previewThis produces numbered PNG previews and plan.json; it never opens Bluetooth or moves paper. Defaults are 50 × 25 mm labels, a 2 mm gap, and darkness 5/5. Other dimensions can be selected with --width-mm, --height-mm, and --gap-mm.
Align the start of a label using the phone app or the printer's established procedure, then disconnect the phone app. Replace U1-XXXX with the exact Bluetooth name or address:
tinylabel print label.png --target U1-XXXX --profile profiles/u1_50x25_gap2.json --journal .label-jobs --job-id order-104-labels-v1 --aligned--aligned acknowledges a physical action already completed by the operator. It does not home the printer. Preserve the journal and reuse the same job ID when checking an existing request; duplicate IDs are rejected, including failed attempts. Never automatically retry an uncertain job under a new ID.
CLI exit code 0 means the operation completed at the software level. Read the JSON state before updating business records. Physical completion requires a separate observation.
import asyncio
from tinylabel_sdk import LabelInput, LabelPrinter, Media, prepare_batch
async def main():
media = Media(width_mm=50, height_mm=25, gap_mm=2)
plan = prepare_batch([LabelInput("label.png", "item-104")], media)
plan.save_previews("preview")
# Operator has already aligned this roll and disconnected the phone app.
async with LabelPrinter("U1-XXXX", journal_dir=".label-jobs") as printer:
printer.confirm_alignment(media, calibration=plan.calibration)
receipt = await printer.print_batch(plan, job_id="order-104-labels-v1")
print(receipt.to_dict()) # transmitted_unconfirmed
asyncio.run(main())For a label management system, keep one worker and one persistent session per printer. Submit successive batches through that session without reinitializing between labels. See the integration contract, including recovery, cancellation, dimensions, and a Node.js bridge.
from tinylabel_sdk import TextLabel, TextStyle, format_text, prepare_text_batch
fields = {"product": "Café molido", "price": "USD 7,82", "lot": "0017"}
label = TextLabel.from_text(
format_text("{product}\n{price}\nLote: {lot}", fields),
label_id="item-0017", style=TextStyle(font_size_mm=3, align="center"),
)
plan = prepare_text_batch([label])
plan.save_previews("preview-text")
# Use the same printer.print_batch(plan, job_id=...) shown above.Or preview external JSON: tinylabel preview-text examples/text_labels.json --out preview-text.
See text configuration and fields for multi-style blocks, fit policies, CLI printing and the boundary with Excel-reading applications.
| Capability | Current status |
|---|---|
| U1 / Tiny protocol, Classic Bluetooth | Single proofs and five-label batch accepted on one U1/Windows setup; broader acceptance pending |
| 50 × 25 mm, 2 mm gap | Starting profile based on prior U1 trials |
| Other roll dimensions | Configurable; require physical calibration and validation |
| Text and externally composed fields | Native raster layout; bundled Noto Sans regular/bold; same pitch as images |
| Other TiMini-Print models | Not enabled by this SDK |
| PDF, ZPL, ESC/POS, USB, Wi-Fi, BLE-only printers | Not exposed by this SDK |
| Automatic gap sensing / homing | Not implemented |
| Verified physical completion acknowledgment | Not available |
The bundled TiMini-Print catalog contains many models; it does not expand this SDK's compatibility. See the full model and platform matrix.
Run tests with python -m unittest discover -s tests -v. Tests use synthetic images and simulated transports; they do not consume labels. Build with python -m pip install build and python -m build.
Code: Apache-2.0. Includes an unmodified, privately namespaced snapshot of TiMini-Print by Daniel Banecki. The pinned revision, license, and notices are included. Bundled Noto Sans fonts use OFL-1.1, with font provenance. See NOTICE, LICENSE, and upstream metadata. TinyLabel is an independent integration project.