Skip to content
Β 
Β 

Latest commit

Β 

History

104 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–¨οΈ thermoprint

Modern, open-source label designer and printing engine for Phomemo, Marklife, and Bluetooth thermal printers

Visual WYSIWYG label editor in the browser, powerful CLI for automation and AI agents, and a platform-agnostic TypeScript core.
No server or drivers required β€” everything runs 100% locally via Web Bluetooth (browser) or Noble (Node/Bun).

Phomemo P12 Marklife P15 Marklife P12 Marklife X2 Marklife M60 Multi-protocol

🌐 Web Editor β€’ Features β€’ Printers β€’ Packages β€’ Quick Start β€’ Architecture β€’ Tech Stack

Version License Bun TypeScript Platform


Features

🌐 Web Editor β€” Open Live Editor

  • Direct Web Bluetooth: Connect straight from Chrome or Edge on macOS, Linux, Windows, ChromeOS, and Android β€” no drivers or companion apps required.
  • Continuous Tape & Die-Cut Modes:
    • Auto-fit continuous tape: Canvas dynamically expands and contracts to fit content, with accurate cutter margin guides.
    • Die-cut labels: Presets and custom sizes for standard thermal sticker rolls.
  • Dynamic Variables & Batch Printing:
    • Autonomous counters: Multi-digit sequential numbering ({{#:001}}), custom steps (+5), countdowns ({{#:100+-1}}), and custom prefixes/suffixes ({{#:SN-0001}}).
    • Spreadsheet data binding: Import .csv or .tsv files to batch print labels with variable text, barcodes, and QR codes ({{Column}}).
    • Live date & time: Auto-updating timestamps and relative offsets ([[DD.MM.YYYY]], [[+7d]], [[+12h]]).
    • Pre-print sanity check: Batch range selector (1-50, 2, 10-15) with a preview table before dispatching to hardware.
    • (See docs/TEMPLATES.md for full syntax and examples)
  • Design Elements:
    • Typography: Curated font library + local system fonts, auto-sizing, and multi-line alignment.
    • Barcodes & QR Codes: EAN-13, CODE-128, UPC, and QR codes with dynamic data binding.
    • Vector Icons: Search 200,000+ vector icons via Iconify (Lucide, Material, Tabler, etc.).
    • Shapes & Images: Lines, rectangles, circles, stars, and custom image uploads.
  • Templates & Local Storage: Save labels in browser storage, export/import JSON templates, or backup the library as a ZIP archive.
  • Printer Telemetry: Live battery status and hardware state monitoring.

πŸ’» CLI & Automation

  • Headless Printing: Print images and JSON label templates directly from scripts, terminal, or AI agents.
  • Discovery & Status: Scan nearby Bluetooth printers and query battery level.
  • Configuration: Save default printer, density, and paper settings in ~/.thermoprint/config.json.

βš™οΈ Core Engine (@thermoprint/core)

  • Platform-Agnostic: Shared protocols and imaging pipeline across Web, Node, Bun, and CLI.
  • Hardware Flow Control: Credit-based packet scheduling prevents buffer overflows on thermal printheads.
  • Binarization Pipeline: Floyd-Steinberg dithering and thresholding optimized for 1-bit thermal printheads.

Supported Printers

Vendor Model Protocol ID Print Width Paper Types Status
Phomemo P12 / P12-Pro pho-p12 96 px (12 mm) Continuous tape βœ… Fully Supported
Phomemo D30 pho-p12 96 px (12 mm) Gap & Continuous βœ… Fully Supported
Marklife P15 mark-l11 384 px (48 mm) Gap & Continuous βœ… Fully Supported
Marklife P12 mark-l11 384 px (48 mm) Gap & Continuous βœ… Fully Supported
Marklife P7 mark-l11 384 px (48 mm) Gap & Continuous βœ… Fully Supported
Marklife X2 mark-x2 384 px (48 mm) Gap & Continuous βœ… Fully Supported
Marklife M60 mark-x2 384 px (48 mm) Gap & Continuous βœ… Fully Supported
Generic Other L11 / X2 / P12 Auto-detected Varies Gap & Continuous βœ… Compatible

Packages

thermoprint/
  packages/
    core/     @thermoprint/core  β€” protocols, imaging pipeline, device profiles
    cli/      @thermoprint/cli   β€” terminal CLI (Noble + sharp)
    web/      @thermoprint/web   β€” browser WYSIWYG editor (React 19 + Konva.js)
Package Description Transport
@thermoprint/core Shared protocols, image processing, device profiles Injectable BleTransport
@thermoprint/cli Terminal interface and automation engine @stoprocent/noble (Node / Bun)
@thermoprint/web Browser label editor with canvas and template engine Web Bluetooth API

Quick Start

🌐 Web Editor (No Install Needed)

Open phanex.github.io/thermoprint in Google Chrome or Microsoft Edge, connect your printer via Web Bluetooth, design your label, and click Print.

πŸ’» CLI

# Clone repository
git clone https://github.com/phanex/thermoprint.git
cd thermoprint

# Install dependencies
bun install

# Discover nearby printers (requires Bluetooth enabled)
bun run packages/cli/src/index.ts discover

# Print an image file
bun run packages/cli/src/index.ts print label.png --density 2

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Web Editor (React 19 + Konva.js)             β”‚
β”‚   Toolbar β†’ Canvas β†’ Dynamic Fit β†’ Print via Web BLE    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              CLI (Commander + Chalk + Ora)              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              Printer Orchestrator (Core)                β”‚
β”‚         connect Β· print Β· telemetry Β· discovery         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Image   β”‚       Protocols       β”‚        Device        β”‚
β”‚ Pipeline β”‚ (pho-p12 / mark-l11)  β”‚       Registry       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              FlowController                             β”‚
β”‚         Credit-based BLE packet chunking                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚         BleTransport (injected)                         β”‚
β”‚     Noble Β· Web Bluetooth Β· custom                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack


License & Attribution

This project is licensed under the MIT License.

Originally created by Tom Ladder. Forked, actively extended, and maintained by phanex.

About

πŸ–¨οΈ Design and print labels for Marklife/Pristar P15, P12, P7 and other Bluetooth thermal printers. Visual drag-and-drop label editor in the browser, CLI for terminal printing, and a platform-agnostic TypeScript core. Supports text, images, QR codes, barcodes. No server needed.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages