diff --git a/src/printer/printHelpers/addTextLine.ts b/src/printer/printHelpers/addTextLine.ts index f1046e6..297b367 100644 --- a/src/printer/printHelpers/addTextLine.ts +++ b/src/printer/printHelpers/addTextLine.ts @@ -5,19 +5,22 @@ import { PrinterConstants, DEFAULT_PAPER_WIDTH } from '../constants'; export async function addTextLine( printer: Printer, - params: SpaceBetweenParams + params: SpaceBetweenParams, + customCharsPerLine?: number ) { const printerCharsPerLinePerWidth = getFontACharsPerLine(printer.deviceName); const { value: paperWidth } = await printer.getPrinterSetting( PrinterConstants.PRINTER_SETTING_PAPERWIDTH ); - const charsPerLine = - printerCharsPerLinePerWidth[paperWidth || DEFAULT_PAPER_WIDTH]; + const charsPerLine = customCharsPerLine + ? customCharsPerLine + : printerCharsPerLinePerWidth[paperWidth || DEFAULT_PAPER_WIDTH]; const text = spaceBetween( Math.ceil(charsPerLine / printer.currentFontWidth), params ); + await printer.addText(text); }