This is an android xprinter driver.
npm install react-native-xprinterXprinter driver currently only support android, and it's not finished yet.
``bash`
$ npm install react-native-xprinter --save
$ react-native link
`js
import { NativeModules } from 'react-native';
import RNXprinter from 'react-native-xprinter';
RNXprinter.initialize();
// Select a printer to use
let printerList = await RNXprinter.getDeviceList();
await RNXprinter.selectDevice(printerList[0].address);
// Or you can use printer pick panel
RNXprinter.pickPrinter();
`
`js`
await RNXprinter.printDemoPage();
`js
// Push Text
// text: string # The string you want to print
// size: number # 0 ~ 7 Level
RNXprinter.pushText("Hello World!!!", 0);
// Push Image
// size: index # The FLASH index of image
// Currently only supported without download image, you need use your computer to help
RNXprinter.pushFlashImage(0);
// Push Cut Paper
RNXprinter.pushCutPaper();
`
js
await RNXprinter.print();
`Contributing
1. Fork it!
2. Create your feature branch:
git checkout -b my-new-feature
3. Commit your changes: git commit -am 'Add some feature'
4. Push to the branch: git push origin my-new-feature`- [x] Android support
- [x] Save default printer
- [ ] Test coverage
- [x] Printer select panel
- [ ] Download image to printer
- [ ] USB support
TODO: Write history
TODO: Write credits