Files
product-slip/README.md
2026-10-05 14:08:11 +03:30

79 lines
3.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Lithium | Print Label
A self-hosted web application for tracking production orders and generating pixel-perfect labels for canisters and boxes.
## Features
- **Fast Data Entry**: Instantly calculate the required number of canister and box labels based on total order weight.
- **Dynamic Print Layouts**: Automatically generate print-ready A4 pages correctly formatted for pre-printed sticker sheets.
- **Print Queue**: Manage and track pending label batches with real-time updates.
- **Bilingual Interface**: Seamlessly switch between English and Persian (LTR).
---
## 🚀 Installation & Deployment
The application is fully containerized using Docker, meaning it can be deployed on any machine with Docker installed.
### Prerequisites
1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/) (Windows/Mac) or Docker Engine (Linux).
2. Ensure you have the project source code downloaded and extracted.
### Starting the Server
1. Open a terminal or command prompt and navigate to the project directory:
```bash
cd path/to/product-slip
```
2. (Optional) Copy `.env.example` to `.env` and adjust settings:
```bash
cp .env.example .env
```
- `HTTP_PORT` — host port for the app (default `80`)
- `APT_MIRROR` — Debian apt mirror host used during image build
- `PIP_INDEX_URL` / `PIP_TRUSTED_HOST` — PyPI mirror used by pip during image build
3. Start the application stack using Docker Compose:
```bash
docker compose up -d --build
```
4. The server is now running! You can access the application from any device on the same local network:
- If you are on the same machine: Open your browser and go to `http://localhost` (or `http://localhost:$HTTP_PORT` if you changed the port)
- If you are on a different machine on the same network: Find the host computer's local IP address (e.g., `192.168.1.15`) and go to `http://192.168.1.15` (add `:$HTTP_PORT` if not using port 80)
### Stopping the Server
To safely stop the application without losing data:
```bash
docker compose down
```
*(Note: Your database is stored safely in the `./data` folder and will persist between restarts).*
---
## 🖨️ Printer Calibration Guide
Because the application prints dynamic text directly over your physical, pre-printed A4 label sheets, the printer's alignment must be exact. Different browsers and physical printers feed paper with slight millimeter variances.
Follow these steps to calibrate the alignment for your specific printer:
### 1. Open the Calibrate tab
1. Open the application and navigate to **Calibrate** in the top menu.
2. You will see a live A4 preview (2×2 slips) and a control panel with millimeter positions.
### 2. Print and check the alignment
1. Load a **blank** piece of A4 paper into your printer.
2. Click **Print** on the calibrate page.
3. Place the printed sheet perfectly behind one of your **actual pre-printed label sheets**.
4. Hold them both up to a light source (window or lamp).
5. The crosshairs (`┼`) should sit inside the target boxes (Batch, Date, Next Control, and Weight).
### 3. Adjust positions in the UI
If text is too high, low, or off to the side, nudge it in the panel — no code edits or Docker restart needed.
1. Use **+/−** (or type a value) for each field’s `top` / `left` (and font if needed).
- Move **DOWN**: increase `top`.
- Move **RIGHT**: increase `left`.
2. Click a crosshair on the preview to jump to that field’s controls; arrow keys also nudge the selection.
3. Click **Save** when it looks right. Values are stored in `data/calibration.json` (same persistent data volume as the database).
4. Print a new calibration sheet and overlay again until perfect.
5. **Reset defaults** restores the built-in starting positions.
Order print pages load the latest saved calibration automatically when you open Print (no hard refresh required).