1.0.2 • Published 6 months ago

react-native-epson-escposprinter v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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:

  1. Epson ePOS SDK for Android Version 2.29.0a
  2. Epson ePOS SDK for iOS Version 2.29.1a

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

  1. yarn install
  2. cd examples/testprint-app
  3. Prebuild in New Architecture by running yarn arch:new, or run yarn arch:old to test in legacy environments.
  4. Run yarn android to test in Android
  5. 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.