Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/383.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Javascript向打印机发送原始ZPL和EPL_Javascript_Printing_Zpl_Thermal Printer_Epl - Fatal编程技术网

从Javascript向打印机发送原始ZPL和EPL

从Javascript向打印机发送原始ZPL和EPL,javascript,printing,zpl,thermal-printer,epl,Javascript,Printing,Zpl,Thermal Printer,Epl,我需要从javascript向打印机发送原始ZPL和EPL代码。通过一些研究,我能够部分地通过这个实现它 这使得将原始ZPL发送到打印机成为可能。我的问题是,同样的方法不适用于EPL。每当我试图发送EPL时,我都会以空白标签结束 是@Lakerfield的代码,他的代码是EPL代码的一个示例。EPL示例代码已经过测试,因此我知道它与语法错误无关 因此,考虑到这种情况,是否需要更改任何内容才能发送EPL?可能是您的打印机设置为打印ZPL,在这种情况下,您需要在发送标签之前将其设置为打印EPL。您可

我需要从javascript向打印机发送原始ZPL和EPL代码。通过一些研究,我能够部分地通过这个实现它

这使得将原始ZPL发送到打印机成为可能。我的问题是,同样的方法不适用于EPL。每当我试图发送EPL时,我都会以空白标签结束

是@Lakerfield的代码,他的代码是EPL代码的一个示例。EPL示例代码已经过测试,因此我知道它与语法错误无关


因此,考虑到这种情况,是否需要更改任何内容才能发送EPL?

可能是您的打印机设置为打印ZPL,在这种情况下,您需要在发送标签之前将其设置为打印EPL。您可以使用
device.languages
SGD命令将其设置为打印EPL:

!U1 setvar“device.languages”“epl”

更多信息请参见本文件第661页:

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