react-native-usb-thermal-printer-broadcasting
v1.0.4
Published
React Native USB Thermal Printer for ESC/POS printers with paper cut and feed support. A perfect libarary to manage USB thermal printing, with Broadcast feature.
Maintainers
Readme
React Native USB Thermal Printer
A React Native library for printing to USB thermal printers on Android using ESC/POS commands.
This package allows React Native applications to easily connect to a USB thermal printer and print formatted text.
It is designed for POS systems, billing apps, restaurant printers, and receipt printing.
Features
✔ USB Thermal Printer Support
✔ Works with ESC/POS printers
✔ Supports 2-inch (58mm), 3-inch (80mm), and 4-inch (110mm) paper widths
✔ Fast printing performance
✔ Simple API for React Native developers
Platform Support
| Platform | Supported | | -------- | --------- | | Android | ✅ Yes | | iOS | ❌ No |
USB host access is only available on Android devices.
Installation
Install the package:
npm npm install react-native-usb-thermal-printer-broadcastingor
yarn add npm install react-native-usb-thermal-printer-broadcastingAndroid Requirements
Make sure your Android device supports USB OTG and the printer is connected using a USB OTG cable.
The library automatically links using React Native autolinking.
Minimum Android SDK:
minSdkVersion = 21Usage
Import the library:
import UsbPrinter from "npm install react-native-usb-thermal-printer-broadcasting";1️⃣ Scan for USB Printer
const printer = await UsbPrinter.scanPrinters();
console.log("Printer Found:", printer);2️⃣ Print Text
Example Receipt
Available Sizes: MM58, MM80, MM100
await UsbPrinter.printText(
"[C]<b>USB TEST PRINT</b>\n" +
"[C]================\n" +
"[L]Product[R]Price\n" +
"[L]Coffee[R]10\n" +
"[L]Burger[R]50\n" +
"{cut}",
UsbPrinter.PAPER_SIZES.MM80
);Supported Paper Sizes
| Paper | Width | | ------ | ----- | | 2 inch | 58mm | | 3 inch | 80mm | | 4 inch | 110mm |
---
## ESC/POS Formatting
You can use ESC/POS tags for formatting:
| Tag | Description |
| ------------------- | ------------ |
| `[L]` | Left Align |
| `[C]` | Center Align |
| `[R]` | Right Align |
| `<font size='big'>` | Large Text |
| `<b>` | Bold Text |
Example:
[C]HELLO
---
## Requirements
- React Native 0.71+
- Android device with USB OTG support
- ESC/POS compatible printer
---
## Example Use Cases
• POS systems
• Restaurant order printers
• Billing applications
• Receipt printing
• Warehouse label printing
---
## Troubleshooting
### Printer not detected
Make sure:
• USB OTG cable is connected
• Printer is powered on
• Device supports USB host
---
### Permission denied
Reconnect the printer and allow USB permission when prompted.
---
## License
MIT License
---
## Author
Created by **Ashwani Panchal (Devroid)**