react-native-thermal-receipt-printer
Version:
Fork of react-native-printer. A React Native Library to support USB/BLE/Net printer
52 lines (51 loc) • 1.84 kB
TypeScript
import { NativeEventEmitter } from "react-native";
export interface PrinterOptions {
beep?: boolean;
cut?: boolean;
tailingLine?: boolean;
encoding?: string;
}
export interface IUSBPrinter {
device_name: string;
vendor_id: string;
product_id: string;
}
export interface IBLEPrinter {
device_name: string;
inner_mac_address: string;
}
export interface INetPrinter {
device_name: string;
host: string;
port: number;
}
export declare const USBPrinter: {
init: () => Promise<void>;
getDeviceList: () => Promise<IUSBPrinter[]>;
connectPrinter: (vendorId: string, productId: string) => Promise<IUSBPrinter>;
closeConn: () => Promise<void>;
printText: (text: string, opts?: PrinterOptions) => void;
printBill: (text: string, opts?: PrinterOptions) => void;
};
export declare const BLEPrinter: {
init: () => Promise<void>;
getDeviceList: () => Promise<IBLEPrinter[]>;
connectPrinter: (inner_mac_address: string) => Promise<IBLEPrinter>;
closeConn: () => Promise<void>;
printText: (text: string, opts?: PrinterOptions) => void;
printBill: (text: string, opts?: PrinterOptions) => void;
};
export declare const NetPrinter: {
init: () => Promise<void>;
getDeviceList: () => Promise<INetPrinter[]>;
connectPrinter: (host: string, port: number) => Promise<INetPrinter>;
closeConn: () => Promise<void>;
printText: (text: string, opts?: {}) => void;
printBill: (text: string, opts?: {}) => void;
};
export declare const NetPrinterEventEmitter: NativeEventEmitter;
export declare enum RN_THERMAL_RECEIPT_PRINTER_EVENTS {
EVENT_NET_PRINTER_SCANNED_SUCCESS = "scannerResolved",
EVENT_NET_PRINTER_SCANNING = "scannerRunning",
EVENT_NET_PRINTER_SCANNED_ERROR = "registerError"
}