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.
- Thermal Printer Application
- 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.
You can install the Thermal Printer Application directly from GitHub:
pipx install printerm- Python 3.13 or higher
- Networked Thermal Printer compatible with the python-escpos library
- Optional for GUI: PyQt6
- Optional for Web App: Flask
After installation, you can use the printerm command:
printerm --helpList available templates:
printerm print-templatePrint using a template:
printerm print-template <template_name>Example:
printerm print-template taskSet the printer IP address:
printerm settings set-ip <printer_ip>Show current settings:
printerm settings showManually update the application:
printerm updateLaunch the GUI:
printerm guiFeatures:
- Select templates and fill in required variables.
- Access settings to configure the application.
- Print directly from the interface.
Launch the web server:
printerm webBy 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.
The application uses a configuration file config.ini, located in user config directory. You can edit this file directly or through the application interfaces.
- 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).
printerm config editOpen config.ini in your preferred text editor and modify the settings.
Templates define what and how the content is printed. They are stored in the printerm/print_templates/ directory as YAML files.
- 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.
- 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- Clone the repository:
git clone https://github.com/AN0DA/printerm.git- Navigate to the project directory:
cd printerm- Install the dependencies:
uv syncWe use pytest for testing. To run the tests:
make testWe follow PEP 8 style guidelines. Please ensure your code passes style checks using tools like flake8 or black.
make lint mypyWe 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.
- Follow the existing code style.
- Write tests for your changes.
- Update documentation if necessary.
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.
Label Printer icon by Icons8