BlueGit

timfa posprint

Files

posprint / README.md

README.md

README.md 4.0 KiB Download Raw

posprint

Cross-platform designer for POS (point-of-sale) receipt documents. Edit templates in a markdown-like syntax, preview output live, substitute runtime parameters, and print directly to USB serial POS printers via raw ESC/POS bytes.

Target platforms: Windows and Linux (x64).

Status

v0.1.0 MVP — Rust + egui app with editor, preview, help, .pos files, parameters, and USB-serial printing.

Build and run

cargo test          # 31 unit tests
cargo run           # launch the designer
cargo build --release

Scripts: scripts/build-windows.ps1, scripts/build-linux.sh, scripts/build-arch.sh (see docs/BUILD.md).

Command-line printing

# Windows
posprint print receipt.pos -p COM3 --set StoreName="Shop" --set DocumentNumber=42

# Linux
posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="Shop" --set DocumentNumber=42

All ${Parameters} must be supplied via --set NAME=VALUE or the command fails.

Linux: add your user to the dialout group for USB-serial printer access.

Releases (GitLab CI)

PlatformArtifactInstall
Linux (Debian/Ubuntu).deb (amd64)sudo dpkg -i posprint_*_amd64.deb then sudo apt-get install -f
Linux (Arch).pkg.tar.zst (x86_64)sudo pacman -U posprint_*_x86_64.pkg.tar.zst
Windowsposprint.exeDownload from GitLab release job artifacts

Tag a version (e.g. v0.1.0) to trigger release builds.

Features

  • Markdown-like template editor with live preview
  • Page width: auto-scale or fixed width (mm)
  • Save and load .pos files
  • Parameter tokens (${DocumentNumber}) with print-time popup and value reuse
  • Barcodes, QR codes, and images (including parameterized content)
  • Print to USB-serial POS printers via raw ESC/POS bytes
  • In-app Help tab (from docs/HELP.md)

Dependencies (minimal)

CrateWhy
eframe / eguiNative UI
serde / serde_json.pos file format
serialportUSB-serial printer I/O
imageLoad PNG/JPEG for @image
rfdNative open/save dialogs
barcodersRaster barcode rendering
qrcodeRaster QR rendering
clapCLI print subcommand

ESC/POS encoding is implemented in-tree.

Design documents

DocumentDescription
FEASIBILITY.mdFeasibility assessment, complexity estimate, risks
LANGUAGE-CHOICE.mdLanguage and framework recommendation
HELP.mdUser reference (mirrored in-app Help tab)
ARCHITECTURE.mdSystem architecture and module breakdown
DSL-SPEC.mdDocument markup language (.pos body syntax)
FILE-FORMAT.md.pos file envelope (metadata + body)
PRINTING.mdPrinter discovery, transport, ESC/POS pipeline
BUILD.mdLocal build scripts and Linux package formats

Documentation must stay aligned with the codebase; see .cursor/rules/documentation.mdc.

Planned features

  • Bluetooth printer support (deferred)

Quick feasibility summary

Verdict: feasible for a small team or solo developer, with the printing layer as the main engineering risk.

AreaComplexityNotes
Editor + preview UIMediumWell-trodden path
DSL parser + rendererMediumCustom grammar, bounded scope
ParametersLowStraightforward substitution
Barcodes / QR / imagesLow–MediumMature libraries exist
USB / BT printer I/OHighOS differences, device quirks
Overall (MVP)Medium–High~6–10 weeks for one experienced dev

Stack: Rust + egui (single language, minimal dependencies). USB-serial printing only in v1. See LANGUAGE-CHOICE.md and docs/HELP.md.

Source
1# posprint
2
3Cross-platform designer for POS (point-of-sale) receipt documents. Edit templates in a markdown-like syntax, preview output live, substitute runtime parameters, and print directly to USB serial POS printers via raw ESC/POS bytes.
4
5**Target platforms:** Windows and Linux (x64).
6
7## Status
8
9**v0.1.0 MVP** — Rust + egui app with editor, preview, help, `.pos` files, parameters, and USB-serial printing.
10
11## Build and run
12
13```bash
14cargo test # 31 unit tests
15cargo run # launch the designer
16cargo build --release
17```
18
19**Scripts:** `scripts/build-windows.ps1`, `scripts/build-linux.sh`, `scripts/build-arch.sh` (see [docs/BUILD.md](docs/BUILD.md)).
20
21### Command-line printing
22
23```bash
24# Windows
25posprint print receipt.pos -p COM3 --set StoreName="Shop" --set DocumentNumber=42
26
27# Linux
28posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="Shop" --set DocumentNumber=42
29```
30
31All `${Parameters}` must be supplied via `--set NAME=VALUE` or the command fails.
32
33**Linux:** add your user to the `dialout` group for USB-serial printer access.
34
35## Releases (GitLab CI)
36
37| Platform | Artifact | Install |
38|----------|----------|---------|
39| Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
40| Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint_*_x86_64.pkg.tar.zst` |
41| Windows | `posprint.exe` | Download from GitLab release job artifacts |
42
43Tag a version (e.g. `v0.1.0`) to trigger release builds.
44
45## Features
46
47- Markdown-like template editor with live preview
48- Page width: auto-scale or fixed width (mm)
49- Save and load `.pos` files
50- Parameter tokens (`${DocumentNumber}`) with print-time popup and value reuse
51- Barcodes, QR codes, and images (including parameterized content)
52- Print to USB-serial POS printers via raw ESC/POS bytes
53- In-app **Help** tab (from [docs/HELP.md](docs/HELP.md))
54
55## Dependencies (minimal)
56
57| Crate | Why |
58|-------|-----|
59| `eframe` / `egui` | Native UI |
60| `serde` / `serde_json` | `.pos` file format |
61| `serialport` | USB-serial printer I/O |
62| `image` | Load PNG/JPEG for `@image` |
63| `rfd` | Native open/save dialogs |
64| `barcoders` | Raster barcode rendering |
65| `qrcode` | Raster QR rendering |
66| `clap` | CLI `print` subcommand |
67
68ESC/POS encoding is implemented in-tree.
69
70## Design documents
71
72| Document | Description |
73|----------|-------------|
74| [FEASIBILITY.md](docs/FEASIBILITY.md) | Feasibility assessment, complexity estimate, risks |
75| [LANGUAGE-CHOICE.md](docs/LANGUAGE-CHOICE.md) | Language and framework recommendation |
76| [HELP.md](docs/HELP.md) | **User reference** (mirrored in-app Help tab) |
77| [ARCHITECTURE.md](docs/ARCHITECTURE.md) | System architecture and module breakdown |
78| [DSL-SPEC.md](docs/DSL-SPEC.md) | Document markup language (`.pos` body syntax) |
79| [FILE-FORMAT.md](docs/FILE-FORMAT.md) | `.pos` file envelope (metadata + body) |
80| [PRINTING.md](docs/PRINTING.md) | Printer discovery, transport, ESC/POS pipeline |
81| [BUILD.md](docs/BUILD.md) | Local build scripts and Linux package formats |
82
83Documentation must stay aligned with the codebase; see `.cursor/rules/documentation.mdc`.
84
85## Planned features
86
87- Bluetooth printer support (deferred)
88
89## Quick feasibility summary
90
91**Verdict: feasible** for a small team or solo developer, with the printing layer as the main engineering risk.
92
93| Area | Complexity | Notes |
94|------|------------|-------|
95| Editor + preview UI | Medium | Well-trodden path |
96| DSL parser + renderer | Medium | Custom grammar, bounded scope |
97| Parameters | Low | Straightforward substitution |
98| Barcodes / QR / images | Low–Medium | Mature libraries exist |
99| USB / BT printer I/O | **High** | OS differences, device quirks |
100| **Overall (MVP)** | **Medium–High** | ~6–10 weeks for one experienced dev |
101
102Stack: **Rust + egui** (single language, minimal dependencies). USB-serial printing only in v1. See [LANGUAGE-CHOICE.md](docs/LANGUAGE-CHOICE.md) and [docs/HELP.md](docs/HELP.md).