@danushka96/expo-r330-printer
v0.2.2
Published
R330 Printer Module
Downloads
9
Maintainers
Readme
expo-r330-printer
Expo module (React Native / Expo) wrapper for vendor R330 series receipt printer service (Android).
This repo contains the native Android module and a small Expo example app used for testing.
⚠️ This module relies on a vendor Android service that exposes an AIDL interface:
recieptservice.com.recieptservice.PrinterInterface. Make sure that service is available on target devices.
Quick install (consumer project)
From a consuming project (React Native / Expo with autolinking enabled):
# If published to npm (replace with actual package name)
npm install expo-r330-printer
# or
yarn add expo-r330-printerThen rebuild native app:
# For bare React Native
npx react-native run-android
# For Expo (dev client)
npx expo run:androidIf you are using the managed Expo client (not a dev client), native modules won't work — you must use a custom dev client or bare workflow.
Usage (JS / TS)
This module exposes a simple API. Example usage in React:
import ExpoR330Printer from "expo-r330-printer";
async function test() {
try {
// Bind to the vendor printer service
await ExpoR330Printer.bind();
// Print text
await ExpoR330Printer.printText("Hello from Expo!\n");
// Print a base64 PNG image (data URI or raw base64)
await ExpoR330Printer.printBitmapBase64("data:image/png;base64,...");
// Print raw Epson bytes (send as base64)
await ExpoR330Printer.printEpsonBase64("<base64-data>");
// Print barcode / QR
await ExpoR330Printer.printBarCode("123456", 6, 162, 2);
await ExpoR330Printer.printQRCode("https://example.com", 4, 3);
// Text formatting
await ExpoR330Printer.setAlignment(1); // 0 left,1 center,2 right
await ExpoR330Printer.setTextSize(24); // number
await ExpoR330Printer.setTextBold(true);
await ExpoR330Printer.nextLine(1);
// Table printing
await ExpoR330Printer.printTableText(["Item","Qty","Price"], [1,1,1], [1,1,1]);
// Unbind
await ExpoR330Printer.unbind();
} catch (e) {
console.error("Printer error", e);
}
}
