BlueGit

timfa posprint

Files

posprint / README.md

README.md

README.md 3.7 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 via raw ESC/POS (USB printer-class, Windows spooler, USB-serial, or optional LAN TCP 9100).

Target platforms: Windows and Linux (x64).

Status

v0.5.5 — Tab completion caret fix, multi-word barcode/QR data, native HRI off by default.

Build and run

Requires Rust 1.88+ (rustup or pacman -S rust on Arch). See docs/BUILD.md for OS libraries and package scripts.

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

Scripts: scripts/build-windows.ps1, scripts/build-linux.sh, scripts/build-arch.sh (Interactive shells offer to install missing dependencies.)

Command-line printing

# Windows (serial or spooler queue name)
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

# Embedded CLI help for this OS
posprint cli-help

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

Linux serial: add your user to the dialout group.

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. 0.4.0) to trigger release builds. If AUR publishing is configured, the same tag pipeline also updates the AUR package.

Features

  • Markdown-like template editor with live preview (Design tab)
  • Page width (mm) and calibrated preview zoom
  • Save and load .pos files
  • Parameter tokens: ${Name} (text) and $[Name] (bool checkbox) via print dialog and CLI --set
  • Inline ASCII checkboxes ([] / [ ] / [x]) — CP437-safe on thermal printers
  • Nested bullet lists, headings, @date / @time, barcodes, QR, images
  • Print via USB-direct, Windows spooler, serial (baud probed), or optional LAN TCP 9100
  • In-app Help tab (from docs/HELP.md)

Documentation

DocumentDescription
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
POSPRINT-URL.mdposprint:// deep links and lib/ helpers
AUR.mdAUR package layout, secrets, and tag-driven publishing
BUILD.mdLocal build scripts and Linux package formats

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

Dependencies (minimal)

CrateWhy
eframe / eguiNative UI
serde / serde_json.pos file format
serialportSerial printer I/O
rusbUSB printer-class devices
imageLoad PNG/JPEG for @image
rfdNative open/save dialogs
barcodersRaster barcode rendering
qrcodeRaster QR rendering
clapCLI print / link / cli-help
flate2 / base64posprint:// URL payload
ureqDownload @image http(s)://…

ESC/POS encoding is implemented in-tree.

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 via raw ESC/POS (USB printer-class, Windows spooler, USB-serial, or optional LAN TCP 9100).
4
5**Target platforms:** Windows and Linux (x64).
6
7## Status
8
9**v0.5.5** — Tab completion caret fix, multi-word barcode/QR data, native HRI off by default.
10
11## Build and run
12
13Requires **Rust 1.88+** ([rustup](https://rustup.rs/) or `pacman -S rust` on Arch). See [docs/BUILD.md](docs/BUILD.md) for OS libraries and package scripts.
14
15```bash
16cargo test # unit tests
17cargo run # launch the designer
18cargo build --release
19```
20
21**Scripts:** `scripts/build-windows.ps1`, `scripts/build-linux.sh`, `scripts/build-arch.sh`
22(Interactive shells offer to install missing dependencies.)
23
24### Command-line printing
25
26```bash
27# Windows (serial or spooler queue name)
28posprint print receipt.pos -p COM3 --set StoreName="Shop" --set DocumentNumber=42
29
30# Linux
31posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="Shop" --set DocumentNumber=42
32
33# Embedded CLI help for this OS
34posprint cli-help
35```
36
37All `${Parameters}` must be supplied via `--set NAME=VALUE` or the command fails.
38
39**Linux serial:** add your user to the `dialout` group.
40
41## Releases (GitLab CI)
42
43| Platform | Artifact | Install |
44|----------|----------|---------|
45| Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
46| Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint_*_x86_64.pkg.tar.zst` |
47| Windows | `posprint.exe` | Download from GitLab release job artifacts |
48
49Tag a version (e.g. `0.4.0`) to trigger release builds. If AUR publishing is configured, the same tag pipeline also updates the AUR package.
50
51## Features
52
53- Markdown-like template editor with live preview (Design tab)
54- Page width (mm) and calibrated preview zoom
55- Save and load `.pos` files
56- Parameter tokens: `${Name}` (text) and `$[Name]` (bool checkbox) via print dialog and CLI `--set`
57- Inline ASCII checkboxes (`[]` / `[ ]` / `[x]`) — CP437-safe on thermal printers
58- Nested bullet lists, headings, `@date` / `@time`, barcodes, QR, images
59- Print via USB-direct, Windows spooler, serial (baud probed), or optional LAN TCP 9100
60- In-app **Help** tab (from [docs/HELP.md](docs/HELP.md))
61
62## Documentation
63
64| Document | Description |
65|----------|-------------|
66| [HELP.md](docs/HELP.md) | **User reference** (mirrored in-app Help tab) |
67| [ARCHITECTURE.md](docs/ARCHITECTURE.md) | System architecture and module breakdown |
68| [DSL-SPEC.md](docs/DSL-SPEC.md) | Document markup language (`.pos` body syntax) |
69| [FILE-FORMAT.md](docs/FILE-FORMAT.md) | `.pos` file envelope (metadata + body) |
70| [PRINTING.md](docs/PRINTING.md) | Printer discovery, transport, ESC/POS pipeline |
71| [POSPRINT-URL.md](docs/POSPRINT-URL.md) | `posprint://` deep links and `lib/` helpers |
72| [AUR.md](docs/AUR.md) | AUR package layout, secrets, and tag-driven publishing |
73| [BUILD.md](docs/BUILD.md) | Local build scripts and Linux package formats |
74
75Documentation must stay aligned with the codebase; see `.cursor/rules/documentation.mdc`.
76
77## Dependencies (minimal)
78
79| Crate | Why |
80|-------|-----|
81| `eframe` / `egui` | Native UI |
82| `serde` / `serde_json` | `.pos` file format |
83| `serialport` | Serial printer I/O |
84| `rusb` | USB printer-class devices |
85| `image` | Load PNG/JPEG for `@image` |
86| `rfd` | Native open/save dialogs |
87| `barcoders` | Raster barcode rendering |
88| `qrcode` | Raster QR rendering |
89| `clap` | CLI `print` / `link` / `cli-help` |
90| `flate2` / `base64` | `posprint://` URL payload |
91| `ureq` | Download `@image http(s)://…` |
92
93ESC/POS encoding is implemented in-tree.