Skip to main content

Console Integration

Plato Console uses the WIN_DRIVER printer adapter for the PC printer driver.

Printer Record

Console stores printers in an IndexedDB database named printer-database. Printer records include:
  • printer type
  • status
  • last error
  • config
  • paper width
  • categories
  • order types
  • logo
Relevant type:
type PrinterType =
  | "EPSON"
  | "WIN_DRIVER"
  | "USB"
  | "BUILT_IN"
  | "ANDROID_DRIVER"
  | "SUNMI";

Driver URL

The WIN_DRIVER adapter builds its base URL from printer config:
http://<driverIpAddress>:<driverPort>
https://<driverIpAddress>:<driverPort>
If driverPort is empty, the adapter omits the port. This is useful for HTTPS on port 443.

Printer Target

The adapter sends the physical printer target separately from the driver URL.
Config FieldRequest FieldNotes
driverIpAddressURL hostMachine running plato-printer.exe.
driverPortURL portDriver HTTP/HTTPS port.
driverUseHttpsURL protocolUses https when true.
ipAddressip_addressPhysical printer IP.
portportPhysical printer TCP port.
vendorvendor_idMapped vendor ID.
productIdproduct_idSent for compatibility.
beepbeepEnables post-print beep sequence.
If the printer IP is missing or equals 192.168.0.0, the adapter sends ip_address: null and port: null, which the current driver rejects with Missing printer address.

Vendor IDs

The adapter maps vendors:
VendorVendor ID
EPSON0x04b8
BIRCH0x1fc9
PHILIPS0x0471
SUNMI0x04b8
OSCAR0x04b8
Console print flow:
  1. Render DOM to PNG blob.
  2. Load blob into canvas.
  3. Convert canvas pixels to black/white raster rows.
  4. Split raster rows into 128-row chunks.
  5. Encode each chunk as ESC/POS raster bytes.
  6. Base64 encode each byte chunk.
  7. Send POST /print.
The driver never receives HTML. It receives printable ESC/POS chunks.

Browser Queue

Console has a local browser queue before requests reach the PC driver.
  • Jobs are stored in IndexedDB.
  • Jobs move from pending to printing.
  • Failed jobs are marked failed.
  • A stale printing job is recovered after 60 seconds.
  • Scheduled jobs are checked every 30 seconds.
  • Failed jobs are retried every 60 seconds.
The PC printer driver has its own Redis queue after the HTTP request is accepted. That means there are two queues:
QueueLocationPurpose
Browser queuePlato Console IndexedDBKeeps POS-side print jobs until a driver accepts them.
Driver queueRedis/BullMQKeeps accepted jobs until the physical printer receives them.

Status Mapping

Console calls POST /status.
  • HTTP failure returns OFFLINE.
  • Response with ok: true and status not offline returns ONLINE.
  • Other driver responses are stored as lastError.

Cash Drawer

Console calls POST /cash-drawer for every online printer configured with a cash drawer.