Hi Guys tried the below code for checking qz runing but i face a issue : Error unable to establish connection with qz tray .
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<!-- USAGE: index.php?var1=some_value_to_print -->
<?php
if (isset($_GET["var1"]))
{ echo '<!-- FROM PHP --><script>var var1 = "' . htmlspecialchars($_GET["var1"]) . '";</script>'; }
else {?> <form action="index.php" method="get">Some value: <input type="text" name="var1"><br> <input type="submit" value="Print"></form></body></html> <?php die(); } ?>
<script>
var printer = "Epson"; qz.websocket.connect().then(function() { return qz.printers.find(printer); }).then(function(found) {
var config = qz.configs.create(found); var data = "\n\n\n\n\n\n\n\n\n\n" + var1 +// echoed above via php "\n\n\n\n\n\n\n\n\n\n"; return qz.print(config, [data]); }).then(qz.websocket.disconnect).then(function() { document.getElementById('status').innerHTML = 'Done'; }).catch(function(err) { document.getElementById('status').innerHTML = err + '<br><a href="qz:launch">Launch QZ</a>'; throw err; });
</script>
<h1 id="status">Attempting to print...</h1>
</body>
</html>
Please help me in solving the issue