diff --git a/__tests__/resources/cmp-20_qrcode.bin b/__tests__/resources/cmp-20_qrcode.bin index 1db6ec8..cf4dcfb 100644 Binary files a/__tests__/resources/cmp-20_qrcode.bin and b/__tests__/resources/cmp-20_qrcode.bin differ diff --git a/__tests__/resources/dr800_draw_buffer.bin b/__tests__/resources/dr800_draw_buffer.bin index ffbf404..6c2b67d 100644 Binary files a/__tests__/resources/dr800_draw_buffer.bin and b/__tests__/resources/dr800_draw_buffer.bin differ diff --git a/__tests__/resources/mp-4200_th_draw_buffer.bin b/__tests__/resources/mp-4200_th_draw_buffer.bin index df51fde..4d6fd80 100644 Binary files a/__tests__/resources/mp-4200_th_draw_buffer.bin and b/__tests__/resources/mp-4200_th_draw_buffer.bin differ diff --git a/__tests__/resources/mp-4200_th_draw_file.bin b/__tests__/resources/mp-4200_th_draw_file.bin index df51fde..4d6fd80 100644 Binary files a/__tests__/resources/mp-4200_th_draw_file.bin and b/__tests__/resources/mp-4200_th_draw_file.bin differ diff --git a/__tests__/resources/printid_qrcode.bin b/__tests__/resources/printid_qrcode.bin index 5e51788..3f22144 100644 Binary files a/__tests__/resources/printid_qrcode.bin and b/__tests__/resources/printid_qrcode.bin differ diff --git a/src/profile/index.ts b/src/profile/index.ts index 7b9f819..95f7036 100644 --- a/src/profile/index.ts +++ b/src/profile/index.ts @@ -127,15 +127,20 @@ export abstract class Profile { async draw(image: Image): Promise { const low = String.fromCharCode(image.width & 0xff); const high = String.fromCharCode((image.width >> 8) & 0xff); + // Set correct line spacing await this.connection.write(Buffer.from('\x1B3\x10', 'ascii')); + // Print image slice by slice for (let y = 0; y < image.lines; y++) { + // Bit-image slice const data = image.lineData(y); await this.connection.write( Buffer.from(this.bitmapCmd + low + high, 'ascii'), ); await this.connection.write(data); - await this.connection.write(Buffer.from('\x1BJ\x00', 'ascii')); + // Paper feed + await this.connection.write(Buffer.from('\x0A', 'ascii')); } + // Reset the line spacing to default return this.connection.write(Buffer.from('\x1B2', 'ascii')); }