diff --git a/print.ts b/print.ts index 5114a65..76f0016 100644 --- a/print.ts +++ b/print.ts @@ -9,16 +9,17 @@ const statics: any = { const mmToInch = 0.0393701; // 26x51 label, or 1" x 2" -const pageSize = getPageLengthParameters(2); +const pageWidth = getPageDimensionParameters(2); +const pageHeight = getPageDimensionParameters(1); const command = ` ESC i a 00h ESC @ ESC i L 01h - ESC ( C 02h 00h ${pageSize.mL} ${pageSize.mH} + ESC ( C 02h 00h ${pageWidth.mL} ${pageWidth.mH} ESC $ CBh 00h - ESC ( V 02h 00h CBh 00h + ESC ( V 02h 00h ${pageHeight.mL} ${pageHeight.mH} ESC k 0Bh - ESC X 00h 64h 00h + ESC X 00h 40h 00h At your side FF `; @@ -37,8 +38,8 @@ function toHex(value: number) { return value.toString(16).padStart(2, '0') + 'h'; } -function getPageLengthParameters(widthInInches: number) { - const dots = inchToDots(widthInInches); +function getPageDimensionParameters(inInches: number) { + const dots = inchToDots(inInches); const mH = Math.floor(dots / 265); const mL = dots - mH * 265;