nosmok...@gmail.com
unread,Sep 20, 2016, 12:48:30 PM9/20/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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