Getting stucked again - Error: Cannot read property 'sendData' of null

939 views
Skip to first unread message

nosmok...@gmail.com

unread,
Sep 20, 2016, 12:48:30 PM9/20/16
to qz-print
Hello, community

I try to print some TSC PL from webpage. QZ Tray enabled.
Browser Chrome v.52
Here is my boilerplate code:
HTML:
<script src="js/qz-tray.js"></script>
<script src="js/sha-256.min.js"></script>
<script src="js/rsvp-3.1.0.min.js"></script>
...
<textarea id="commands" rows="10" cols="50">...</textarea>
<button id="send">Send</button>
<script>
$('#send').click(function(){
var commands = $('#commands').val();
var config = qz.configs.create("GP");
var lines = commands.split('\n'), data = [];
for(var i = 0;i < lines.length;i++){
var code_string = lines[i].trim();
if (code_string.length > 0) {
data[i] = code_string;
}
}
qz.print(config, data).catch(function(e) {
console.error(e);
});
}
</script>

Then I put test TSC PL code:

SIZE 30 mm,20 mm
GAP 3 mm, 0 mm
DIRECTION 1
OFFSET 3 mm
CLS
BARCODE 10,50,"128",100,1,0,2,2,"12345678"
PRINT 1

Pushed "Send"

and console got me an error
"Cannot read property 'sendData' of null"
on line of code "console.error(e);"

Expanding error in chrome console, I saw this:

TypeError: Cannot read property 'sendData' of null(…)(anonymous function)
@ index.html:63lib$rsvp$$internal$$tryCatch
@ rsvp-3.1.0.min.js:10lib$rsvp$$internal$$invokeCallback
@ rsvp-3.1.0.min.js:10(anonymous function)
@ rsvp-3.1.0.min.js:10lib$rsvp$asap$$flush
@ rsvp-3.1.0.min.js:10

I changed printer GP to {file:"C:\Temp\output.txt"} but got the same error

Any help will very appreciated

Tres Finocchiaro

unread,
Sep 20, 2016, 12:53:45 PM9/20/16
to Hector Barbossa, qz-print
This is generally a sign that you never called qz.websocket.connect().

-Tres

--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages