A Python library for advanced text printing utilities
Project description
PyTextPrinter
A Python library for advanced text printing utilities and ESC/POS thermal printer support.
Features
- Text formatting and styling
- Table printing
- Progress bars
- Banner text generation
- Cross-platform hardware printer support (Windows/Linux/macOS)
- ESC/POS command support for thermal/receipt printers
- WebSocket API with Socket.IO compatibility - See WebSocket Documentation
Installation
pip install pytextprinter
Quick Start
from pytextprinter import TextPrinter
printer = TextPrinter()
printer.print_text("Hello, World!")
printer.print_banner("Welcome to PyTextPrinter")
WebSocket API
PyTextPrinter now includes complete WebSocket support with Socket.IO compatibility! Access all printer functionality over the network in real-time.
Quick WebSocket Example
# Start WebSocket Server
from pytextprinter.websocket_server import PyTextPrinterWebSocketServer
import asyncio
async def start_server():
server = PyTextPrinterWebSocketServer(host='localhost', port=8080)
await server.start_server()
asyncio.run(start_server())
# WebSocket Client
from pytextprinter.websocket_client import PyTextPrinterWebSocketClient
import asyncio
async def client_example():
client = PyTextPrinterWebSocketClient('http://localhost:8080')
await client.connect()
# Use any PyTextPrinter function via WebSocket
await client.print_text("Hello WebSocket!")
await client.list_printers()
await client.print_to_hardware("Receipt text\n")
await client.disconnect()
asyncio.run(client_example())
📖 For complete WebSocket documentation, examples, and API reference, see: WEBSOCKET_IMPLEMENTATION.md
Development
Setup Development Environment
pip install -e .
pip install -r requirements-dev.txt
Running Tests
pytest
Building Documentation
cd docs
make html
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please read our contributing guidelines and submit pull requests.
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 pytextprinter-0.1.0.tar.gz.
File metadata
- Download URL: pytextprinter-0.1.0.tar.gz
- Upload date:
- Size: 29.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5b05ac6289928851a7c92f1df156906a7a2aac9ef47a1a6d77e4fa8d081b704
|
|
| MD5 |
99a9307eb9af2db68d454899279087bb
|
|
| BLAKE2b-256 |
da78c83038f5fb984f81a716c8cea9bd4a3f578c26cae1fa89cec169f0cac0b3
|
File details
Details for the file pytextprinter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytextprinter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a11a4e799d658e96f7f0f10d299e78a2a20d56ea25a6aa62bfb7cf6bc64e3f6
|
|
| MD5 |
e63727c592a5b95b02ba11bad3656f24
|
|
| BLAKE2b-256 |
0e3b69eceb679911cf74c770644122c1296f9a0f2e7840d442cea3880fcc782e
|