Skip to content

bencomtech/react-native-pos-printer

Repository files navigation

react-native-pos-printer

react native module for printing receipt on pos printer. (only support for android)

Installation

npm install react-native-pos-printer

Usage

import PosPrinter from 'react-native-pos-printer';

Init Printer

Initializes printer, the return will be Promise

PosPrinter.init(isDebug?)
    .then((res) => console.log(res))
    .catch((err) => console.log(err));

Get Devices

Get all printer devices, the return will be Promise<Printer[]>

PosPrinter.getDevices()
  .then((device) => console.log(device))
  .catch((err) => console.log(err));

Scan Devices

Scan all devices printer, the return will be Promise

PosPrinter.scanDevices()
  .then((res) => console.log(res))
  .catch((err) => console.log(err));

Stop Scan Devices

Stop scanning all devices printer, the return will be Promise

PosPrinter.stopScanDevices()
  .then((res) => console.log(res))
  .catch((err) => console.log(err));

Connect Device

Connect to specific pos printer, the return will be Promise

PosPrinter.connectDevice(deviceId, timeout)
  .then((res) => console.log(res))
  .catch((err) => console.log(err));

Print Test Receipt

Test print on pos printer

PosPrinter.printTestReceipt(storageUrl?)
    .then((res) => console.log(res))
    .catch((err) => console.log(err));

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library