Skip to content

Instantly share code, notes, and snippets.

@reboot81
Forked from Lakerfield/index.html
Created September 6, 2021 21:46
Show Gist options
  • Save reboot81/b5a6608e8df7faaf26dda4380e735962 to your computer and use it in GitHub Desktop.
Save reboot81/b5a6608e8df7faaf26dda4380e735962 to your computer and use it in GitHub Desktop.
Print ZPL from browser
<!doctype html>
<html lang="en">
<head>
<title>Print ZPL from browser</title>
</head>
<body>
<h1>Test page for print ZPL from browser!</h1>
<script type="text/javascript">
function printZpl(zpl) {
var printWindow = window.open();
printWindow.document.open('text/plain')
printWindow.document.write(zpl);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
</script>
</body>
<input type="button" value="Print zpl" onclick="printZpl(document.getElementById('zplcode').value)" /><br/>
<textarea id="zplcode" cols="40" rows="20">^XA
^XA
^FO250,40^A0N,70,70^FDLPN^FS
^FO30,120^A0N,50,50
^BCN,100,N,N,N
^FD7310400022537^SFddddddd^FS
^FO200,300^A0N,50,50
^FD7310400022537^SFddddddd^FS
^PQ50
^XZ
</textarea>
<p>Use the build in windows [Generic / Text Only] driver for your Zebra printer. Instead of the zebra driver. </p>
<p>Tested in: <b>Edge, Internet Explorer, Firefox</b></p>
<p>Not working in: Chrome (Chrome prints as image and not in text)</p>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment