Printing KOT & Receipts from React Native: BLE, ESC/POS, and Real-World Pitfalls
A field guide to building reliable Bluetooth thermal printing for restaurants — including separate KOT and receipt flows.
📋 Table of Contents
💡 What You'll Learn
A field guide to building reliable Bluetooth thermal printing for restaurants — including separate KOT and receipt flows.
Printing KOT & Receipts from React Native: BLE, ESC/POS, and Real-World Pitfalls
Thermal printing looks simple until you add two printers, unreliable Bluetooth, and kitchen heat. Here’s how we built KOT (Kitchen Order Ticket) and receipt printing that just works.
Architecture
- BLE layer:
react-native-ble-plxto scan/connect and maintain device registry. - Print driver:
react-native-thermal-printerwith an adapter that formats ESC/POS commands. - Manager: A
PrinterManagersingleton keeps state for receipt and KOT printers separately. - Queue: A job queue with retries, back-off, and idempotency.
KOT vs Receipt
KOT: fast, minimal output — table, items, qty, modifiers, order notes, timestamp, and docket number.
Receipt: totals, tax, discount, payment method, QR (UPI), branding, and optional footer.
We maintain two templates and two queues. KOT prints immediately when the order is confirmed; receipts print after payment confirmation.
Reliability Tactics
- Sticky connections: Auto-reconnect when RSSI drops. Persist
deviceIdby role. - Idempotent commands: Wrap jobs with IDs and dedupe; safe to retry after partial prints.
- Gap sensors & paper: For label printers, send feed commands to align between prints.
- Watchdogs: Detect stalled transfers; reset connection and resume.
Formatting Tips
- Use a monospace layout or width-aware functions for 58mm printers.
- Map Unicode to printer code pages; pretest common glyphs (₹, ₹ with spaces, diacritics).
- Print QR for UPI and barcode for invoice lookup.
- Add cut and feed smartly; avoid cutting mid-ticket.
Testing Checklist
- [ ] Print with low battery and weak signal
- [ ] Long item names & multi-byte characters
- [ ] Burst prints at peak hours
- [ ] KOT only includes items after “Print KOT” action
- [ ] Graceful handling when a printer is offline
With a clean separation of concerns and defensive retries, BLE printing can be rock-solid even on busy nights.
🎯 Key Takeaways
- Expert insights on technical development
- Practical implementation strategies
- Best practices from industry professionals
- Actionable steps for your next project
📚 Continue Reading
Related Article 1
Discover more insights on technical development...
Related Article 2
Discover more insights on technical development...
Related Article 3
Discover more insights on technical development...
