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
18 lines (17 loc) • 798 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addTextLine = addTextLine;
var _index = require("../utils/index.js");
var _index2 = require("../constants/index.js");
async function addTextLine(printer, params, customCharsPerLine) {
const printerCharsPerLinePerWidth = (0, _index.getFontACharsPerLine)(printer.deviceName);
const {
value: paperWidth
} = await printer.getPrinterSetting(_index2.PrinterConstants.PRINTER_SETTING_PAPERWIDTH);
const charsPerLine = customCharsPerLine ? customCharsPerLine : printerCharsPerLinePerWidth[paperWidth || _index2.DEFAULT_PAPER_WIDTH];
const text = (0, _index.spaceBetween)(Math.ceil(charsPerLine / printer.currentFontWidth), params);
await printer.addText(text);
}
//# sourceMappingURL=addTextLine.js.map