BlueGit

timfa posprint

Files

posprint / docs / HELP-CLI-LINUX.md

HELP-CLI-LINUX.md

HELP-CLI-LINUX.md 2.2 KiB Download Raw

Command-line printing (Linux)

Print a .pos template without opening the GUI.

Run posprint cli-help to print this section from the binary (no GUI required).

Syntax

posprint print <file.pos> --printer <DEVICE> --set Name=Value [--set Other=Value ...]
posprint link <file.pos>

Short form:

posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="My Shop" --set DocumentNumber=1001
posprint link receipt.pos

Rules

  • --printer / -p (required): serial device path (e.g. /dev/ttyUSB0, /dev/ttyACM0), LAN host / host:9100, or another printer id accepted by discovery.
  • --set NAME=VALUE (required for every parameter): one flag per ${Name} or $[Name] in the template.
  • Checkbox params ($[Name]): use true/false (also 1/0, yes/no).
  • If any text ${Name} is missing or empty, or a $[Name] is omitted / not a boolean, the command fails.
  • The GUI is not started when using the print subcommand.
  • posprint link encodes the .pos file as a posprint:// URL on stdout (see POSPRINT-URL.md). Warns if the URL is very long.

Permissions

Your user must be in the dialout group:

sudo usermod -aG dialout "$USER"
# log out and back in
groups

Examples

posprint print ~/receipts/sale.pos -p /dev/ttyUSB0 \
  --set StoreName="Corner Cafe" \
  --set DocumentNumber=42 \
  --set Date=2026-07-15 \
  --set GrandTotal=19.99

Printer device

ls -l /dev/ttyUSB* /dev/ttyACM* 2>/dev/null

Use the device node shown when the printer is connected.

Exit codes

CodeMeaning
0Printed successfully
1Error (missing parameters, parse error, permission denied, etc.)

Help

posprint print --help
posprint link --help
posprint --help

Launch the graphical designer by running posprint with no subcommand. Opening a posprint://… URL (from a browser) or posprint --print starts print-only mode: live preview on the left, parameters and printer on the right.

After package install, if posprint:// links do not open:

xdg-mime default posprint-url.desktop x-scheme-handler/posprint
Source
1# Command-line printing (Linux)
2
3Print a `.pos` template without opening the GUI.
4
5Run `posprint cli-help` to print this section from the binary (no GUI required).
6
7## Syntax
8
9```bash
10posprint print <file.pos> --printer <DEVICE> --set Name=Value [--set Other=Value ...]
11posprint link <file.pos>
12```
13
14Short form:
15
16```bash
17posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="My Shop" --set DocumentNumber=1001
18posprint link receipt.pos
19```
20
21## Rules
22
23- **`--printer` / `-p`** (required): serial device path (e.g. `/dev/ttyUSB0`, `/dev/ttyACM0`), LAN `host` / `host:9100`, or another printer id accepted by discovery.
24- **`--set NAME=VALUE`** (required for every parameter): one flag per `${Name}` or `$[Name]` in the template.
25- Checkbox params (`$[Name]`): use `true`/`false` (also `1`/`0`, `yes`/`no`).
26- If any text `${Name}` is missing or empty, or a `$[Name]` is omitted / not a boolean, the command **fails**.
27- The GUI is not started when using the `print` subcommand.
28- **`posprint link`** encodes the `.pos` file as a `posprint://` URL on stdout (see [POSPRINT-URL.md](POSPRINT-URL.md)). Warns if the URL is very long.
29
30## Permissions
31
32Your user must be in the **`dialout`** group:
33
34```bash
35sudo usermod -aG dialout "$USER"
36# log out and back in
37groups
38```
39
40## Examples
41
42```bash
43posprint print ~/receipts/sale.pos -p /dev/ttyUSB0 \
44 --set StoreName="Corner Cafe" \
45 --set DocumentNumber=42 \
46 --set Date=2026-07-15 \
47 --set GrandTotal=19.99
48```
49
50## Printer device
51
52```bash
53ls -l /dev/ttyUSB* /dev/ttyACM* 2>/dev/null
54```
55
56Use the device node shown when the printer is connected.
57
58## Exit codes
59
60| Code | Meaning |
61|------|---------|
62| `0` | Printed successfully |
63| `1` | Error (missing parameters, parse error, permission denied, etc.) |
64
65## Help
66
67```bash
68posprint print --help
69posprint link --help
70posprint --help
71```
72
73Launch the graphical designer by running `posprint` with **no** subcommand. Opening a `posprint://…` URL (from a browser) or `posprint --print` starts print-only mode: live preview on the left, parameters and printer on the right.
74
75After package install, if `posprint://` links do not open:
76
77```bash
78xdg-mime default posprint-url.desktop x-scheme-handler/posprint
79```