react-native-esc-pos-printer
Version:
An unofficial React Native library for printing on an EPSON TM printer with the Epson ePOS SDK for iOS and Epson ePOS SDK for Android
14 lines (13 loc) • 725 B
JavaScript
;
import { spaceBetween, getFontACharsPerLine } from "../utils/index.js";
import { PrinterConstants, DEFAULT_PAPER_WIDTH } from "../constants/index.js";
export async function addTextLine(printer, params, customCharsPerLine) {
const printerCharsPerLinePerWidth = getFontACharsPerLine(printer.deviceName);
const {
value: paperWidth
} = await printer.getPrinterSetting(PrinterConstants.PRINTER_SETTING_PAPERWIDTH);
const charsPerLine = customCharsPerLine ? customCharsPerLine : printerCharsPerLinePerWidth[paperWidth || DEFAULT_PAPER_WIDTH];
const text = spaceBetween(Math.ceil(charsPerLine / printer.currentFontWidth), params);
await printer.addText(text);
}
//# sourceMappingURL=addTextLine.js.map