# ZPLServer — Windows x86

ZPLServer is a self-contained background service that processes ZPL label data.
- It can convert ZPL commands to PNG, JPG, PDF, PCX, PCL, GRF, EPL, FP, and NV formats.
- The rendering output can be saved as a file or HTTP POST the rendered output.

## Prerequisites

- Windows 7 SP1 or later / Windows Server 2008 R2 or later (32-bit)
- Administrator rights to install and manage the Windows Service

## Package Contents

| File | Description |
|---|---|
| `ZPLServer.exe` | Self-contained service binary |
| `install.ps1` | Installs and starts ZPLServer as a Windows Service |
| `uninstall.ps1` | Stops, removes the service, and deletes all files |
| `README.md` | This file |

## Installation

Open **PowerShell as Administrator**, navigate to this folder, and run:

```powershell
.\install.ps1
```

The script will:
1. Copy `ZPLServer.exe` to `C:\Program Files\ZPLServer\`
2. Register it as a Windows Service that starts automatically at boot
3. Start the service immediately

## Verify

Once installed, open the Settings page in your browser:

```powershell
# PowerShell
& "C:\Program Files\ZPLServer\ZPLServer.exe" --settings
```

```cmd
:: Command Prompt
"C:\Program Files\ZPLServer\ZPLServer.exe" --settings
```

## CLI Reference

| Command | Action |
|---|---|
| *(no args)* | Start the background service |
| `--settings` | Open the Settings page in the browser |
| `--logs` | Open the Logs page in the browser |
| `--doc` | Open the developer guide in browser |
| `--device-id` | Returns the current Device ID |
| `--port` | Returns the current listening port |
| `--set-port <port>` | Change the listening port (hot-reload if running) |
| `--set-license <key>` | Set the license key (hot-reload if running) |
| `--health` | Check if server is running |
| `--help` | Print usage information |

> **PowerShell note:** always use the `&` call operator when the path is quoted:
> `& "C:\Program Files\ZPLServer\ZPLServer.exe" --settings`

## Logs

Logs are available through the web UI (opened via `--logs`).
The log files are saved at:

```
%LOCALAPPDATA%\ZPLServer\logs
```

## Configuration

All configuration is managed through the web UI (opened via `--settings`).
The settings file is saved at:

```
%LOCALAPPDATA%\ZPLServer\settings
```

## License

Enter your license key through the Settings page.
The license file is stored at:

```
%LOCALAPPDATA%\ZPLServer\license
```

Or run the following:

```powershell
# PowerShell
& "C:\Program Files\ZPLServer\ZPLServer.exe" --set-license <key>
```

```cmd
:: Command Prompt
"C:\Program Files\ZPLServer\ZPLServer.exe" --set-license <key>
```

## Firewall

If ZPLServer needs to be reachable from other machines on the network, add an inbound firewall rule. Replace `9100` with the port shown in the Settings page:

```powershell
New-NetFirewallRule -DisplayName "ZPLServer" -Direction Inbound -Protocol TCP -LocalPort 9100 -Action Allow
```

## Uninstall

Open **PowerShell as Administrator** and run:

```powershell
.\uninstall.ps1
```

To also remove user settings and license data, pass the `-RemoveData` flag:

```powershell
.\uninstall.ps1 -RemoveData
```

## Troubleshooting

| Issue | Action |
|---|---|
| `install.ps1` is blocked by execution policy | Run `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass` first |
| Service fails to start | Open Event Viewer → Windows Logs → Application and look for ZPLServer errors |
| Settings page does not open | Confirm the service is running: `sc.exe query ZPLServer` |
