Printing From Websites Part 3

Robin West -
2 MIN READ
1306
6

Hello Programmers!  I’m back again with my series on printing from within websites.  This time I’m going to talk about using a client program to print. 

 

The downside is that, until recently, you had to write a client program for every OS you wanted to support with your website.  There is still the possibility that you may want to do that, but there are now several options to serve this need.

 

The benefits of using a client program are that most support multiple connectivity types like USB, Network, and Bluetooth.  They also are now supporting multiple OS's.  Some of these programs are self-contained and handle many aspects of printing including status checking and formatting.  Other programs provide a large amount of control to you as the web developer to handle the entire user experience.  Regardless of which you choose, your website coding to work with these apps is minimal.

 

Zebra has our own app to enable web-based printing called Browser Print.  This first release is for PC and USB connections, but stay tuned as we look into other operating systems, browsers, and connectivity types.  We are providing a JavaScript library and simple sample code to help enable your web apps.  It gives you full bi-directional control of the printer to get status and settings as well as print.

 

If your web app is primarily targeted towards mobile devices, Zebra has several partners with excellent apps that work with your webpages to allow your customers to print.  Sample code is easy to integrate. These apps are designed to take the heavy lifting of handeling the printer off your hands.

MobiPrint by Arrowhead

Centvia by Centrategy

 

 

Earlier Articles on this topic:

 

 

 

 

Robin West

Solution Architect

Zebra Technologies ISV

profile

Robin West

Please Register or Login to post a reply

6 Replies

P Pankaj Pandey

Hi Robin,

I am trying to Print a 2D Barcode Label with My GX430t Zebra Printer.
I am using JavaScript for Sending ZPL commands to the printer. Below is the JS Code:

var zpl = "^XA^FO50,100^BXN,10,200^FDYourTextHere^FS^XZ"
  var printWindow = window.open();
  printWindow.document.open('text/plain')
  printWindow.document.write(zpl);
  printWindow.document.close();
  printWindow.focus();
  printWindow.print();
  printWindow.close();

This doesn't print the Barcode but only prints Empty Label and Just one Text Page 1.
Can you help me if I am missing some configuration or code.
I am sending the same ZPL command from the Zebra Utility application and its printing the expected 2D Barcode.

I have also tried using the Generic/Text only driver but that too prints the ZPL commands as it is.

Thanks in advance.

D Dirk van der Laarse

Hi Robin ( <a href></a>​)

Thanks for all the information on printing on my Zebra printer from websites. I have a quick question:

I've followed all the steps outlined in the Browser Print User Guide, and successfully printed via the sample index.html page (USB connection and opening file on local machine). The guide is not very clear on going to the next step: printing from the opened html file on other machines on the network. My first guess is that I have to change the IP Address in the BrowserPrint-1.0.2.min file from local host to the IP of the machine with the Browser Print application installed. When I then try to print from another machine via the browser, I get the following error in the console: "The 'Access-Control-Allow-Origin' header contains the invalid value '127.0.0.1'. Origin 'null' is therefore not allowed access."

Can someone point me in the right direction to use the Browser Print application on a machine with Zebra printer connected via USB, and then print from the sample html page on another machine on the same network?

Kind regards,
Dirk

N Noman Waseem

Hello Robin,

If I have more than one Zebra printer attached, is it possible to select which printer to send the commands to on the fly using Javascript?

Thanks!

M Mauricio Guimaraes

Hi Robin,
I guess Browser Print is just what I need. My web app goal is to print labels from the browser to a USB connected Zebra printer.

My problem is, I need to send a list of values, organized in a table, with borders and all. But the sample code provided does not show how to do this, and I've just started working with Zebra printers.

Is there any way to use a label file created with ZebraDesigner and send my list of values as parameters to this label file?

Thanks in advance!

Y Yanis Dalabiras

Yes, ZebraDesigner does support variable fields.&nbsp; Use the 'Export' function in the File menu to get the proper format.&nbsp; You do have to set up the list of parameters properly (without the greater than and less than symbols) in order to tell the printer what to print:
^XA^XF^FN^FD^FS^FN^FD^FS^XZ
so a real print request would look like this:
^XA^XFE:NAMETAG.ZPL^FN11^FDRobin^FS^FN12^FDWest^FS^XZ

O Ori Miller

Hi Rubin,
I'm trying to figure out how to use Browser Print, but I don't have a printer at home.
Is there an emulator that 'Browser Print' can communicate with?
I was able to use the "HTTP POST" method to print ZPL and preview it using 'Zpl Printer' Chrome-Extention, but it has very limited functionality.
Thanks,
Ori Miller
Alma Development
Ex Libris
p.s. I've found it was asked 2 years ago in <a href="https://stackoverflow.com/questions/48714694/emulate-zebra-printer-for-…; but no answers...