Thermal printer printing tool
Project description
Thermal Printer Application
Welcome to the Thermal Printer Application! This project provides a flexible and extensible way to interact with networked thermal printers. It supports printing tasks, tickets, small notes, and custom templates through a Command-Line Interface (CLI), Graphical User Interface (GUI), and a web application.
Table of Contents
- Thermal Printer Application
Features
- Multi-Interface Support: Use the application via CLI, GUI, or web interface.
- Template-Based Printing: Define print templates using YAML files with Jinja2 and Markdown support.
- Dynamic Templates: Easily add new templates without changing the code.
- Auto-Update Feature: Automatically check for updates and prompt the user to update.
- Customizable Settings: Configure printer IP, characters per line, special character handling, and update preferences.
- Support for Special Characters: Handle special characters using transliteration.
Getting Started
Installation
You can install the Thermal Printer Application directly from GitHub:
pipx install printerm
Requirements
- Python 3.13 or higher
- Networked Thermal Printer compatible with the python-escpos library
- Optional for GUI: PyQt6
- Optional for Web App: Flask
Usage
Command-Line Interface
After installation, you can use the printerm command:
printerm --help
Printing a Template
List available templates:
printerm print-template
Print using a template:
printerm print-template <template_name>
Example:
printerm print-template task
Updating Settings
Set the printer IP address:
printerm settings set-ip <printer_ip>
Show current settings:
printerm settings show
Manual Update
Manually update the application:
printerm update
Graphical User Interface
Launch the GUI:
printerm gui
Features:
- Select templates and fill in required variables.
- Access settings to configure the application.
- Print directly from the interface.
Web Application
Launch the web server:
printerm web
By default, the web app runs on http://0.0.0.0:5555. Open this URL in your browser.
Features:
- Select and print templates.
- Access and update settings.
- User-friendly interface accessible from any device on the network.
Configuration
The application uses a configuration file config.ini, located in user config directory. You can edit this file directly or through the application interfaces.
Configuration Options
- Printer IP Address: The IP address of your thermal printer.
- Characters Per Line: Number of characters the printer can print per line (default is 32).
- Enable Special Letters: Enable or disable special character handling (True/False).
- Check for Updates: Enable or disable automatic update checks (True/False).
Editing Configuration
Through the CLI
printerm config edit
Manually
Open config.ini in your preferred text editor and modify the settings.
Templates
Templates define what and how the content is printed. They are stored in the printerm/print_templates/ directory as YAML files.
Built-in Templates
- Task: Print a task with a title and text.
- Small Note: Print a blank note with space to write.
- Ticket: Print a ticket with a title, ticket number, and text.
- Weekly Agenda: Print a ready-to-fill agenda for the current week.
Adding New Templates
- Create a YAML file in the printerm/print_templates/ directory.
- Define the template with metadata, variables, and segments.
- Use Jinja2 syntax for dynamic content and Mistune-supported Markdown for formatting.
Example template greeting.yaml:
name: Greeting
description: Print a greeting message.
variables:
- name: name
description: Recipient's Name
required: true
- name: message
description: Personal Message
required: true
segments:
- text: "**Hello**, {{ name }}!\n"
styles:
align: center
bold: true
- text: "{{ message }}\n"
styles:
align: left
Development
Setting Up the Development Environment
- Clone the repository:
git clone https://github.com/AN0DA/printerm.git
- Navigate to the project directory:
cd printerm
- Install the dependencies:
uv sync
Running Tests
We use pytest for testing. To run the tests:
make test
Code Style and Formatting
We follow PEP 8 style guidelines. Please ensure your code passes style checks using tools like flake8 or black.
make lint mypy
Contributing
We welcome contributions! Here’s how you can help:
- Report Bugs: If you find a bug, please create an issue describing the problem.
- Suggest Features: Have an idea? Open an issue to discuss it.
- Submit Pull Requests: Fork the repository, make your changes, and submit a pull request.
Guidelines
- Follow the existing code style.
- Write tests for your changes.
- Update documentation if necessary.
License
We recommend using the MIT License for this project.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
...
This license is permissive, allowing others to use, modify, and distribute the software with minimal restrictions. It encourages collaboration and sharing while protecting your liability.
See the [LICENSE] file for details.
Credits
Label Printer icon by Icons8
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 printerm-1.3.1.tar.gz.
File metadata
- Download URL: printerm-1.3.1.tar.gz
- Upload date:
- Size: 127.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c06c26b0d1efa129d2da5648a36d6d0e1f3a85c59b8f988659fd9ed166fba523
|
|
| MD5 |
d8beb104e925d70a91d71761960ec303
|
|
| BLAKE2b-256 |
5626e50208e4491f4a059d192267e163af3663d65223e4f61b591c7bb3383f6b
|
Provenance
The following attestation bundles were made for printerm-1.3.1.tar.gz:
Publisher:
release.yaml on AN0DA/printerm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
printerm-1.3.1.tar.gz -
Subject digest:
c06c26b0d1efa129d2da5648a36d6d0e1f3a85c59b8f988659fd9ed166fba523 - Sigstore transparency entry: 600064253
- Sigstore integration time:
-
Permalink:
AN0DA/printerm@678bdd06e6b91d50720d472577822b21f11cf259 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AN0DA
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@678bdd06e6b91d50720d472577822b21f11cf259 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file printerm-1.3.1-py3-none-any.whl.
File metadata
- Download URL: printerm-1.3.1-py3-none-any.whl
- Upload date:
- Size: 69.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94d0d55ecbdc5320873c56f39c188c57d070148759e18050fde2341e0567eaf6
|
|
| MD5 |
000bb2ca400e4bb7d3a6e6d7fd6afb6b
|
|
| BLAKE2b-256 |
fb6be73b14a005d7628f3d8d8b7eba4ca9d2c9a8f9ebcbe0e5282ec84e17b6b3
|
Provenance
The following attestation bundles were made for printerm-1.3.1-py3-none-any.whl:
Publisher:
release.yaml on AN0DA/printerm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
printerm-1.3.1-py3-none-any.whl -
Subject digest:
94d0d55ecbdc5320873c56f39c188c57d070148759e18050fde2341e0567eaf6 - Sigstore transparency entry: 600064254
- Sigstore integration time:
-
Permalink:
AN0DA/printerm@678bdd06e6b91d50720d472577822b21f11cf259 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AN0DA
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@678bdd06e6b91d50720d472577822b21f11cf259 -
Trigger Event:
workflow_dispatch
-
Statement type: