Projects/PyCatPrint - BLE Thermal Printer Control & Simulator
Open Source
backend
iot
Open Source

PyCatPrint - BLE Thermal Printer Control & Simulator

Python CLI & Hardware-Less Simulator for BLE Thermal Printers

Overview

A feature-rich Python CLI tool and hardware simulator for controlling BLE thermal cat printers (PD01, GT01, GB02, MX11). Converts images and multi-page PDFs into printer-compatible binary bitmaps with advanced dithering, hardware-less mock mode, and visual printout PNG rendering.

Key Features

  • Hardware-Less Virtual Simulator (--mock) for offline testing and visual PNG preview generation
  • Reverse-engineered PD01 protocol extracted from Fun Print APK with CRC8 polynomial 0x07 validation
  • Advanced dithering algorithms (Floyd-Steinberg, Atkinson, Bayer 4x4 Halftone)
  • Multi-page PDF extraction with automatic blank-row page separators
  • Auto-discovery and connection retry logic for BLE cat printers (GT01, GB02, MX11, PD01)
  • Terminal ASCII & PNG printout rendering previews
  • 24-test automated pytest suite covering protocol, dithering, mock driver, and CLI commands

Outcomes & Impact

  • Enables full offline hardware-less development and visual printout previewing
  • Reliable low-latency BLE packet transmission with MTU chunking
  • Complete open-source CLI suite with zero physical hardware dependencies

Tech Stack

Python 3.8+

backend

Bleak (BLE)

other

Pillow & NumPy

other

pdf2image & pypdf

other

Click

other

pytest

other

Tags

Python
BLE
Dithering
Hardware Simulator
CLI
IoT
Image Processing

Project Info

Categories

backend, iot, open-source

Status

Public