Co-authored-by: Cursor <cursoragent@cursor.com> Reviewed-on: #14 Co-authored-by: diaco <dyaco8464@yahoo.com> Co-committed-by: diaco <dyaco8464@yahoo.com>
85 lines
3.8 KiB
Markdown
85 lines
3.8 KiB
Markdown
# 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. Print the Calibration Sheet
|
|
1. Open the application and navigate to the **Calibrate** tab in the top menu.
|
|
2. Load a **blank** piece of A4 paper into your printer.
|
|
3. Click the "Print Calibration Sheet" button to print it out.
|
|
|
|
### 2. Check the Alignment
|
|
1. Take your printed blank calibration sheet.
|
|
2. Place it perfectly behind one of your **actual pre-printed label sheets**.
|
|
3. Hold them both up to a light source (like a window or lamp).
|
|
4. Look for the crosshairs (`┼`). They should align perfectly inside the target boxes (Batch, Date, Next Control, and Weight).
|
|
|
|
### 3. Adjusting the Millimeters (If Necessary)
|
|
If the text is printing slightly too high, too low, or too far to a side, you can adjust the CSS margins in the codebase to shift the text.
|
|
|
|
1. Open the file: `slips/templates/slips/print_page.html`
|
|
2. Scroll to the `<style>` block at the top, and find the `.var-field` CSS section.
|
|
3. You will see absolute positioning values in millimeters (`mm`), for example:
|
|
```css
|
|
.val-batch { top: 15mm; left: 40mm; }
|
|
```
|
|
4. **Adjust the numbers**:
|
|
- To move text **DOWN**: Increase the `top` value (e.g., `15mm` -> `17mm`).
|
|
- To move text **RIGHT**: Increase the `left` value (e.g., `40mm` -> `42mm`).
|
|
5. Save the file.
|
|
6. Restart the Docker container so the changes take effect:
|
|
```bash
|
|
docker compose restart app
|
|
```
|
|
7. Print a new calibration sheet and test again until perfect!
|