Caio Sant'Anna
Caio Sant'Anna

Reputation: 342

Send raw ZPL and EPL to printer from Javascript

I need to send raw ZPL and EPL code to the printer from javascript. With some research, I was able to achieve it partially through this answer.

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();
}

That made possible to send raw ZPL to the printer. My problem is that the same method didn't work for EPL. Whenever i try to send EPL I end with a blank label.

This is the fiddle with @Lakerfield's code and this is his code with one example of EPL code. The EPL sample code was tested, so I know it is not something related to syntax errors.

So, considering this context, is there anything that need to be changed in order to be able to send EPL as well ?

Upvotes: 1

Views: 4620

Answers (1)

person
person

Reputation: 458

It could be that your printer is set to print ZPL, in which case you need to set it to print EPL before sending the label. You can use the device.languages SGD command to set it to print EPL:

! U1 setvar "device.languages" "epl"

More in formation in this document on page 661: https://www.zebra.com/content/dam/zebra/manuals/printers/common/zpl-zbi2-pm-en.pdf

Upvotes: 1

Related Questions