qzind / tray

Browser plugin for sending documents and raw commands to a printer or attached device.
https://qz.io
Other
845 stars 275 forks source link

Print html not correct with print stamp and barcode device (label). #1297

Open DiepHoang2711 opened 4 hours ago

DiepHoang2711 commented 4 hours ago
  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!
builam66 commented 3 hours ago

same issue

lehunghxt commented 3 hours ago

same issue