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:
- Text-oriented, and
- 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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcce60a7b51a4b40a25d65c4766b426243d666517118cdddf3717422b69df7a5
|
|
| MD5 |
47886360eefb2a7a383457b4c55d9362
|
|
| BLAKE2b-256 |
a7e892f24eb918cc19fe19b450ff20c3c31b3fbf5e086893373cf2b412f23cfa
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f39795a44acfdc086df75dbebbfb19f34447d1b9bdbfe96c77288cfa727f6765
|
|
| MD5 |
53b7d930cac3bc342fad35f6d4fcfb50
|
|
| BLAKE2b-256 |
482820540129757d7a243f8b47ace83c8a76eadcda76e2b2f37b2bb366bdd591
|