Most Zebra Printers have a HTTP POST endpoint through which ZPL can be directly printed without the need for an installed driver, print dialogs popping up or other locally installed software.
Unfortunately those printers don't set any CORS headers which makes it impossible to use this HTTP endpoint in modern browser-based apps.
This extension circumvents this issue.
Install this extension from the Chrome Web Store or Firefox Addon in your browser (it's free).
In your web app you can now directly print to Zebra printers by using window.postMessage():
window.postMessage({
type: "zebra_print_label",
zpl: "^XA^FO20,20^A0N,30,30^FDThis is a TEST^FS^XZ",
url: "http://192.168.37.36/pstprnt",
id: "my random string"
}, "*");The Zebra Printing extension will listen to those messages and print the zpl to the url.
- type: The extension will only pick up messages where the type is
zebra_print_label - zpl: The ZPL string to be printed
- url: The URL of the printer (local IP or dns name)
- id (optional): A random string that will be posted back to the window posting the ZPL message in order to acknowledge its receival
The extension will also post a message to the web page upon loading. This way in your web app you can check if the extension is installed:
window.addEventListener("message", function (event) {
if (!event.data.ZebraPrintingVersion) {
return;
}
// extension installed, enable print button or whatever...
console.log(event.data);
});The event will contain two fields:
- ZebraPrintingExtensionId: The extension ID (ndikjdigobmbieacjcgomahigeiobhbo)
- ZebraPrintingVersion: The version number of the installed extension
- ZT220 with firmware V72.19.15Z, V72.20.01Z
- ZD620 with firmware V84.20.10Z, V84.20.18Z, V84.20.21Z
- ZD621 with firmware V93.21.07Z
- GK420d with firmware V61.17.17Z
- ZD230 with firmware V89.21.26Z
Feel free to open a pull request to add other supported printers!
For local development/testing:
cd testing/
openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
python3 simple-https-server.py
open https://localhost:4443/Just zip up the extension directory:
zip -FSr extension.zip extensionZebra printers will always return a 200 OK status code whether they were able to print or not.
This extension comes without any warranty.
This extension is not affiliated with Zebra Technologies Corp.
Icon made by Freepik from www.flaticon.com

