1.0.2 • Published 6 months ago
react-native-epson-escposprinter v1.0.2
react-native-epson-escposprinter
A React Native wrapper of the Epson ePOS SDK, supporting the New Architecture and classic builds.
The current version embeds these SDKs:
Usage
Most of the methods are a simple wrapper of the native SDK. For a complete list of methods and their details, you may refer to the API reference file found in the Epson SDK archive.
import {
connect,
discoverPrinters,
getPrinterSeriesFromDeviceName,
PrinterLocale,
} from "react-native-epson-escposprinter";
import { ok } from "assert";
for await (const info of discoverPrinters()) {
const series = getPrinterSeriesFromDeviceName(info.deviceName);
ok(series, `Unknown device ${info.deviceName}`);
const printer = await connect(series, PrinterLocale.MODEL_ANK, info.target);
await printer.transaction(async () => {
await printer.addText("ABC");
await printer.sendData();
await printer.clearCommandBuffer();
});
await printer.disconnect();
}
Building the example app
yarn install
cd examples/testprint-app
- Prebuild in New Architecture by running
yarn arch:new
, or runyarn arch:old
to test in legacy environments. - Run
yarn android
to test in Android - Run
yarn ios
to test in iOS
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
If you use this library at work, consider sponsoring for a first-class technical support.