Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified __tests__/resources/cmp-20_qrcode.bin
Binary file not shown.
Binary file modified __tests__/resources/dr800_draw_buffer.bin
Binary file not shown.
Binary file modified __tests__/resources/mp-4200_th_draw_buffer.bin
Binary file not shown.
Binary file modified __tests__/resources/mp-4200_th_draw_file.bin
Binary file not shown.
Binary file modified __tests__/resources/printid_qrcode.bin
Binary file not shown.
7 changes: 6 additions & 1 deletion src/profile/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,20 @@ export abstract class Profile {
async draw(image: Image): Promise<void> {
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'));
Comment thread
ma-zal marked this conversation as resolved.
}
// Reset the line spacing to default
return this.connection.write(Buffer.from('\x1B2', 'ascii'));
}

Expand Down