Widget passing variables


I have created a widget to print on a local printer using qz


I can get the sample to print but I can't get the passed data to print it keeps saying undefined. How do I get the printData variable down to the data section?
this.onPrint = function(printData){
   qz.websocket.connect().then(function() { 
       return qz.printers.find("Pin Printer")               // Pass the printer name into the next Promise
}).then(function(printer) {
  var config = qz.configs.create(printer);       // Create a default config for the found printer
  var data = ['^XA^FO50,50^ADN,36,20^FDRAW ZPL EXAMPLE^FS^XZ'];   // Raw ZPL
  return qz.print(config, data);
}).catch(function(e) { console.error(e); });

Tim Larson
  • You must to post comments

From the server you call widget.Call(“onPrint”, dataToPrint)?

In the posted snippet, the line that prints is qx.print(config, data) is the line that prints and “data” is the data? IIUC, printData has to be assigned to data?

If you post a small sample I may be able to understand better?


  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.