Skip to main content

A library for writing text to BLE receipt printers

Project description

BLEPrinter

BLEPrinter is a library for working with "cat printers," a sort of cheap receipt printer which communicates using an undocumented protocol over Bluetooth Low Energy. Unlike similar programs, BLEPrinter is:

  1. Text-oriented, and
  2. Meant to be used in other projects.

It achieves the former by taking in formatted text, rendering those inputs an as image, before sending the result over the wire.

Due to the obfuscated nature of the printers, my own limited access to the hardware, and a principled allocation of resources, this code has not been verified to work with all similar devices in every situation. BLEPrinter strives to be robust and sensical, well typed and formatted, not necessarily to handle every edge case.

Where improvements are to be made—I would be thrilled to hear from you and accept your contributions. In particular, weaving in support for images and other content types (such as barcodes or QR codes) would be first on the hypothetical project roadmap.

Documentation and Usage

import asyncio
from bleprinter import Printer

def main():
  p = Printer()
  p.textln("Hello World!", size=4, bold=True, centered=True)
  p.textln("from figbert", size=2, centered=True)

  p.textln("Neat Heading", underline=True)
  p.textln("Fin.")

  asyncio.run(p.cut())

Dependencies

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bleprinter-0.2.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bleprinter-0.2.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file bleprinter-0.2.0.tar.gz.

File metadata

  • Download URL: bleprinter-0.2.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bleprinter-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bcce60a7b51a4b40a25d65c4766b426243d666517118cdddf3717422b69df7a5
MD5 47886360eefb2a7a383457b4c55d9362
BLAKE2b-256 a7e892f24eb918cc19fe19b450ff20c3c31b3fbf5e086893373cf2b412f23cfa

See more details on using hashes here.

File details

Details for the file bleprinter-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bleprinter-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bleprinter-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f39795a44acfdc086df75dbebbfb19f34447d1b9bdbfe96c77288cfa727f6765
MD5 53b7d930cac3bc342fad35f6d4fcfb50
BLAKE2b-256 482820540129757d7a243f8b47ace83c8a76eadcda76e2b2f37b2bb366bdd591

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page