A Flask-based print server application that automates the retrieval of images from a Nextcloud instance, applies custom visual overlays, and manages printing tasks via a modern web interface.
- Nextcloud Integration: Automatically fetches new images and metadata from a specified Nextcloud folder via
NextcloudFetcherThread. - Web Dashboard: A responsive interface to monitor the current print job, manage the print queue, and view unlisted jobs.
- Overlay Editor: A built-in visual editor (
editor.html) to create, save, and apply JSON-based overlays (text, images, dynamic positioning) to print jobs. - Queue Management:
- Auto-Print: Toggle "Print on Receive" to automatically process incoming files.
- Manual Control: Pause/Resume the printer and manually trigger prints from the unlisted buffer.
- Cross-Platform Printing: Supports printing on Windows (via
win32print) and Linux (viacups) handled inprinting.py.
- Python 3.x
- A Nextcloud instance
- Linux: CUPS installed (
libcups2-dev) - Windows: A configured default printer
-
Clone the repository
git clone <repository-url> cd PrinterWebServer
-
Install Dependencies
pip install -r requirements.txt
Note: On Windows, this requires
pywin32. On Linux, this requirespycups. -
Configuration Create a file named
config.ymlin the root directory. Based onConfig.py, it requires the following structure:nc_username: "your_username" nc_password: "your_password" nc_images_folder: "/Photos/PrintQueue" nc_metadata_folder: "/Photos/Metadata" nc_check_time: 5 # Interval in seconds to check for new files
-
Start the Server Run the main entry point:
python main.py
This starts the Flask web server and the background threads for the printer manager and Nextcloud fetcher.
-
Access the Web Interface Open your browser and navigate to:
http://localhost:5000 -
Overlay Editor Navigate to
/editoror click the "Overlay Editor" button in the header to create custom print layouts.
main.py: Application entry point. Initializes the Flask app andPrintManager.src/: Backend logic.PrintManager.py: Central controller for queues and threads.PrintJob.py: Handles image processing and overlay application.image/Overlay.py: Logic for rendering text and image nodes onto the base image.
website/: Flask web application.static/: CSS, JavaScript, and assets.templates/: HTML templates (index.html,editor.html).