A RN library for thermal printer
A RN library for thermal printer
Fork of react-native-printer and add implement for auto connect printer with usb
A React Native Library to support USB/BLE/Net printer
yarn add react-native-thermal-receipt-printer
react-native version >= 0.60, xcode show this errorduplicate symbols for architecture x86_64
that because the .a library uses CocoaAsyncSocket library and Flipper uses it too
Podfile
...
use_native_modules!
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# add_flipper_pods!
# post_install do |installer|
# flipper_post_install(installer)
# end
...
and comment out code related to Flipper in ios/AppDelegate.m
| Printer | Android | IOS |
|---|---|---|
| USBPrinter | :heavy_check_mark: | |
| BLEPrinter | :heavy_check_mark: | :heavy_check_mark: |
| NetPrinter | :heavy_check_mark: | :heavy_check_mark: |
| Tags | Description |
|---|---|
| C | Center |
| D | Medium font |
| B | Large font |
| M | Medium font |
| CM | Medium font, centered |
| CB | Medium font, centered |
| CD | Large font, centered |
To get started with the project, run yarn bootstrap in the root directory to install the required dependencies for each package:
yarn bootstrap
While developing, you can run the example app to test your changes.
To start the packager:
yarn example start
To run the example app on Android:
yarn example dev-android
To run the example app on iOS:
yarn example ios
import {
USBPrinter,
NetPrinter,
BLEPrinter,
} from "react-native-thermal-receipt-printer";
USBPrinter.printText("sample text");
USBPrinter.printBill("sample bill");
interface IUSBPrinter {
device_name: string;
vendor_id: number;
product_id: number;
}
…
interface IBLEPrinter {
device_name: string;
inner_mac_address: string;
}
…
interface INetPrinter {
device_name: string;
host: string;
port: number;
}
Note: get list device for net printers is support scanning in local ip but not recommended
…
No open issues yet, or sync has not completed.