FloDesktop supports two printing modes:
- Desktop App (Electron) - Uses Node.js
node-thermal-printerlibrary - Cloud POS (Future) - Will use WebUSB from browser
The Electron desktop app uses node-thermal-printer library to connect to thermal printers directly via Node.js. This works with:
- USB Thermal Printers - Connected directly to the computer
- Network (IP/TCP) Printers - Thermal printers on the network
For the cloud-based POS running in a browser, WebUSB API will be used to connect directly to thermal printers from the browser.
How it works:
- Uses
node-thermal-printerNode.js library - Directly accesses USB devices through the Electron main process
- Works on Windows, macOS, and Linux
Configuration:
- Paper width: 58mm or 80mm
- No device path needed - the library auto-detects USB printers
How it works:
- TCP socket connection to network thermal printers
- Default port 9100 (standard for thermal printers)
Configuration:
- IP Address (e.g., 192.168.1.100)
- Port (default: 9100)
How it works:
- Uses standard browser print dialog (
window.print()) - Works with any printer connected to the computer
- Supports A4 and A5 paper sizes
The Settings → Printing tab contains:
-
Hardware Printers section
- Add/Edit/Delete printers
- Connection types: Network (IP/TCP), USB (via Electron App)
- Paper width settings (58mm, 80mm)
- Set default printer
- Test print button
-
Print Options section
- Enable/Disable printer
- Paper size selection
- Print method (ESC/POS vs Browser)
- Auto-print KOT (when order placed)
- Auto-print Bill (when payment completed)
- Web print size (A4/A5)
- WhatsApp share enable
-
WhatsApp Sharing section
- Enable WhatsApp Share toggle
POS Order Placed
↓
Backend receives order
↓
Checks default printer from database
↓
If USB printer → node-thermal-printer prints via USB
If Network printer → TCP socket sends ESC/POS commands
↓
Print success/failure logged
POS Order Placed (Browser)
↓
Frontend calls WebUSB API
↓
User selects printer via browser USB picker
↓
ESC/POS commands sent directly via WebUSB
↓
Print success/failure shown in UI
-
Bills - Three templates:
- Classic: Rich legacy-style receipt
- Compact: Minimal, fast printing
- Detailed: Full GST-compliant tax invoice
-
KOT (Kitchen Order Ticket)
- Order number, table, items
- Addons and special instructions
-
WhatsApp Sharing
- Send bill details via WhatsApp after payment
status: Printer connection statusdeviceInfo: Connected printer details (for WebUSB mode)printMethod: 'escpos' or 'browser'paperWidth: 58 or 80- Methods:
connect(),disconnect(),printBill(),printKot()
printerEnabled: Enable/disable printerpaperSize: Thermal58, Thermal80, A4, A5printMethod: ESCPOS or BrowserautoPrintKot: Auto-print KOT toggleautoPrintBill: Auto-print Bill togglebillTemplate: Classic/Compact/DetailedbillFooterMessage: Custom footer text
GET /api/printers- List all printersPOST /api/printers- Add new printerPUT /api/printers/:id- Update printerDELETE /api/printers/:id- Delete printerPOST /api/printers/:id/set-default- Set default printerPOST /api/printers/:id/test- Test print
CREATE TABLE printers (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
connection_type TEXT CHECK(connection_type IN ('network', 'usb')),
ip_address TEXT,
port INTEGER DEFAULT 9100,
usb_device_path TEXT,
paper_width TEXT DEFAULT '80mm',
is_default INTEGER DEFAULT 0,
created_at TEXT,
updated_at TEXT
);- Ensure printer is connected via USB
- Check paper width setting matches printer
- Try Network printer option instead
- Check Electron app logs for errors
- Ensure printer is on same network
- Check IP address and port (default 9100)
- Firewall must allow outbound connections
- Printer must support TCP/IP printing
- Allow popups in browser
- Ensure printer is added to system
- Check printer default settings
frontend/src/lib/printer/PrinterService.ts- WebUSB driver (for cloud POS)frontend/src/lib/printer/receipt-encoder.ts- Receipt encodingfrontend/src/lib/printer/gst-bill-encoder.ts- GST bill encodingfrontend/src/lib/printer/kot-encoder.ts- KOT encodingfrontend/src/lib/printer/web-print.ts- Browser printingfrontend/src/hooks/usePrinter.ts- Printer state managementfrontend/src/components/pos/PrinterStatus.tsx- Toolbar component
main/printers/thermal.ts- Thermal printer handlingmain/routes/printers.ts- Printer API routesmain/ipc.ts- Electron IPC handlersmain/db.ts- Database schema