# Command-line printing (Linux)

Print a `.pos` template without opening the GUI.

## Syntax

```bash
posprint print <file.pos> --printer <DEVICE> --set Name=Value [--set Other=Value ...]
```

Short form:

```bash
posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="My Shop" --set DocumentNumber=1001
```

## Rules

- **`--printer` / `-p`** (required): serial device path, e.g. `/dev/ttyUSB0`, `/dev/ttyACM0`.
- **`--set NAME=VALUE`** (required for every parameter): one flag per `${Name}` in the template.
- If any `${Name}` is missing or empty, the command **fails** and lists missing parameters.
- The GUI is not started when using the `print` subcommand.

## Permissions

Your user must be in the **`dialout`** group:

```bash
sudo usermod -aG dialout "$USER"
# log out and back in
groups
```

## Examples

```bash
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

```bash
ls -l /dev/ttyUSB* /dev/ttyACM* 2>/dev/null
```

Use the device node shown when the printer is connected.

## Exit codes

| Code | Meaning |
|------|---------|
| `0` | Printed successfully |
| `1` | Error (missing parameters, parse error, permission denied, etc.) |

## Help

```bash
posprint print --help
posprint --help
```

Launch the graphical designer by running `posprint` with **no** subcommand.
