Native bridge for Zywell Thermal printer in React Native applications
npm install react-native-zywell-thermal-printer> Maintenance Notice: This library was originally built to serve an internal project at my previous company and is no longer actively maintained. If it works for your use case, please consider using the optimized and actively maintained version managed by the current team: @finan-me/react-native-zywell-thermal-printer
Native bridge for Zywell Thermal printer Zywell Official Site
- Easy integration with Zywell thermal printers
- Supports both iOS and Android
- High performance and reliability
Compatible with thermal printers, Bluetooth printers, LAN printers, and more.(print text, print image,... With size 80mm, 58mm, A4 with customize, ...)
Since this library serves personal purposes, there will not be many updates. If there are any updates, please create a pull request or an issue. Thank you.
``bash`
npm install react-native-zywell-thermal-printeror
yarn add react-native-zywell-thermal-printer
Add the following permissions to your AndroidManifest.xml:
`js`
Please check for additional permissions required by the library.
https://www.npmjs.com/package/react-native-bluetooth-escpos-printer
https://www.npmjs.com/package/react-native-bluetooth-state-manager
https://github.com/HeligPfleigh/react-native-thermal-receipt-printer
`js
import ZywellPrinter from 'react-native-zywell-thermal-printer';
// Connect to a Bluetooth printer
ZywellPrinter.connectBLE('00:11:22:33:FF:EE')
.then(() => {
console.log('Connected to Bluetooth printer');
})
.catch((error) => {
console.error('Failed to connect to Bluetooth printer', error);
});
// Connect to a network printer
ZywellPrinter.connectNet('192.168.xx.xxx')
.then(() => {
console.log('Connected to network printer');
})
.catch((error) => {
console.error('Failed to connect to network printer', error);
});
// Print an image
ZywellPrinter.printPic('00:11:22:33:FF:EE', 'path/to/image.png', {
width: 200,
height: 200,
})
.then(() => {
console.log('Printed image');
})
.catch((error) => {
console.error('Failed to print image', error);
});
// Disconnect from a Bluetooth printer
ZywellPrinter.disconnectPort('00:11:22:33:FF:EE')
.then(() => {
console.log('Disconnected from Bluetooth printer');
})
.catch((error) => {
console.error('Failed to disconnect from Bluetooth printer', error);
});
// Disconnect from a network printer
ZywellPrinter.disconnectNet('192.168.xx.xxx')
.then(() => {
console.log('Disconnected from network printer');
})
.catch((error) => {
console.error('Failed to disconnect from network printer', error);
});
`
Connect to a Bluetooth printer.
- address: The Bluetooth address of the printer.
Connect to a network printer.
- ip: The IP address of the printer.
Print an image.
- address: The Bluetooth address of the printer.imagePath
- : The path to the image file.options
- : The printing options (e.g., width, height).
Disconnect from a Bluetooth printer.
- address: The Bluetooth address of the printer.
Disconnect from a network printer.
- ip: The IP address of the printer.
Please read the code in ZywellThermalPrinterPackage.java and ZywellThermalPrinter.mm for more APIs provided by the package, or you can check the Example directory.
Ex functions such as: printText, isConnect, readBuffer, clearBuffer, disconnectAll, print once, and print multiple`, ...
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
---
Made with create-react-native-library