const void printStamp(deviceName) {
let printData = [{
type: 'pixel',
format: 'html',
flavor: 'plain',
data:
`<!DOCTYPE html><html><head></head><div style="font-family: Arial">` +
'<div>HELLO</div>' +
`</div></html>`,
}];
const config = {
jobName: 'MyJob',
scaleContent: false,
units: 'mm',
};
}
void sendDataToPrinter(deviceName, printData, config);
}
async function sendDataToPrinter(printerName, data, dataConfig) {
var config = qz.configs.create(printerName, dataConfig);
if (!qz.websocket.isActive()) {
qz.websocket
.connect()
.then(() => {
return qz.print(config, data);
})
.catch((e) => {
console.log(e);
});
} else {
return qz.print(config, data).catch((e) => {
console.log(e);
});
}
}
**'< div>HELLO</div>'** this just is my example
Device: X-printer 420B, Window,
Driver: Xprinter_2022.1
Description: I print stamp and barcode by html + pixel. I try to use all qz-tray version (2.2.2, 2.2.3, 2.2.4) but not any version work correctly.
Exception result: 1 stamp
Actual result: 4 stamp ( 1 stamp was deviated, 3 stamp blank)
Note: Three months ago, with this code my printer was still done correctly
Could you help me? Many thanks!