如何从 Web 应用程序打印到收据打印机? [英] How to print from web application to receipt printer?

查看:23
本文介绍了如何从 Web 应用程序打印到收据打印机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户要求我在 Epson TM U220 上打印收据 ( 库,将 jar 文件放在项目目录中,然后你好:

<applet name="jzebra" code="jzebra.PrintApplet.class" archive="./jzebra.jar" width="100" height="100"><param name="printer" value="zebra"></小程序><脚本>功能打印(){document.jzebra.append("使用 JZEBRA 打印
");document.jzebra.print();}

I was asked by my client to print receipts on an Epson TM U220 (http://pos.epson.com/products/TM-U220.htm) from my web application. I have no idea how to do that. Are there any java applets or something else that I can use for printing? Should i use JasperReports? (Does JasperReports help to cope with this problem?) If there are flash apps that could be used, I have no objection to using that.

I am using Grails for my web apps.

解决方案

To get this working, simply setup your receipt printer as the default printer and rename it as "zebra":

Then simply download the jZebra library, put the jar file in the project directory and hey presto:

<input type=button onClick="print()" value="Print">
<applet name="jzebra" code="jzebra.PrintApplet.class" archive="./jzebra.jar" width="100" height="100">
      <param name="printer" value="zebra">
</applet>

<script>
      function print() {
       document.jzebra.append("PRINTED USING JZEBRA
");
       document.jzebra.print();
      }
</script>

这篇关于如何从 Web 应用程序打印到收据打印机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆