【问题标题】:Could I use javascripts window.print to print zpl to a zebra printer that is hooked up via usb?我可以使用 javascripts window.print 将 zpl 打印到通过 USB 连接的斑马打印机吗?
【发布时间】:2018-01-16 12:28:36
【问题描述】:

查看此链接https://www.zebra.com/us/en/products/printers/kiosk.html 后,我认为您可以完成此任务。我只是想知道是否有人尝试过这个。再加上将 chrome 置于 kiosk 模式 (https://mycartpos.zendesk.com/hc/en-us/articles/200868343-Enable-kiosk-printing-print-automatically-for-Google-Chrome-on-Windows) 似乎可以实现自助打印。如果我要解决这个问题并且应该坚持尝试弄清楚如何将原始 zpl 发送到打印机,请告诉我。

【问题讨论】:

    标签: javascript printing zebra-printers zpl kiosk-mode


    【解决方案1】:

    您必须使用 KR403,因为 203 不支持 ZPL。考虑使用 Zebra 的浏览器打印通过此应用程序从 JavaScript 路由到 USB 端口:
    https://www.zebra.com/us/en/products/software/barcode-printers/link-os/browser-print.html

    【讨论】:

    • 我也是这么想的,但没有看到列出的 KR 打印机与浏览器打印兼容。
    • 我也看到了。
    【解决方案2】:

    你为什么不使用网络模式?

    function print()
    {
      var zpl = "YOUR ZPL TEXT"
      var ip_addr = "YOUR IP"
      var output = document.getElementById("output");
      var url = "http://"+ip_addr+"/pstprnt";
      var method = "POST";
      var async = true;
      var request = new XMLHttpRequest();
    
      request.onload = function () {
        var status = request.status; // HTTP response status, e.g., 200 for "200 OK"
        var data = request.responseText; // Returned data, e.g., an HTML document.
        output.innerHTML = "Status: " + status + "<br>" + data;
      }
    
      request.open(method, url, async);
      request.setRequestHeader("Content-Length", zpl.length);
    
      // Actually sends the request to the server.
      request.send(zpl);
    }
    

    【讨论】:

    • 当然,一个有用的答案,但提问者专门寻找 USB,而不是网络模式。至少解释一下它们之间的区别,否则这个答案并不能真正解决问题。
    猜你喜欢
    • 1970-01-01
    • 2016-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多