Skip to main content

react-native-esc-pos-printer

Print receipts natively from React Native on Epson TM printers

npm version

Features

BLE, LAN, USB & Wi-Fi

All major connection methods for Epson TM printers out of the box.

New Architecture Ready

Compatible with React Native's Fabric and Turbo Modules.

Print from RN Views

Capture any React Native View and print it as a raster image.

Built-in Queue

Thread-safe print queue handles concurrent jobs without extra code.

Clear Error Descriptions

Detailed error codes and messages for every printer failure state.

Proxy-like API

Easy to extend with additional ESC/POS commands via addCommand().

Installation

React Native

yarn add react-native-esc-pos-printer

Expo

npx expo install react-native-esc-pos-printer
npx expo prebuild
Complete installation guide →

Quick Example

import { Printer, usePrintersDiscovery } from 'react-native-esc-pos-printer';

function App() {
  const { start, printers } = usePrintersDiscovery();

  const print = async () => {
    const printer = new Printer({ target: printers[0].target, deviceName: printers[0].deviceName });
    await printer.addQueueTask(async () => {
      await Printer.tryToConnectUntil(printer, (s) => s.online.statusCode === PrinterConstants.TRUE);
      await printer.addText('Hello, World!');
      await printer.addFeedLine();
      await printer.addCut();
      const result = await printer.sendData();
      await printer.disconnect();
      return result;
    });
  };

  return <Button title="Print" onPress={print} />;
}
Full API reference →