如何从网络应用程序打印到收据打印机?
我的客户要求我在 Epson TM U220 (http://pos. epson.com/products/TM-U220.htm)来自我的网络应用程序。我不知道该怎么做。是否有任何 Java 小程序或其他可用于打印的东西?我应该使用 JasperReports 吗? (JasperReports 是否有助于解决这个问题?) 如果有可以使用的Flash应用程序,我不反对使用它。
我正在将 Grails 用于我的网络应用程序。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您不需要小程序,您可以从 grails 控制器使用任何 Java 库。使用 javax.print 中运行时可用的 Java 打印服务。这是假设打印机安装在 grails 运行时运行的地方。
You don't need an applet, from a grails controller you may use any Java library. Use the Java printing services available to the runtime in javax.print. This is assuming that the printer is installed where the grails runtime is running.
要实现此功能,只需将收据打印机设置为默认打印机并将其重命名为“zebra”:
然后只需下载 jZebra 库,将 jar 文件放入项目目录中即可:
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:
不久前,我创建了一个应用程序来写入 POS 系统的收据打印机。我们这样做的方法是打开一个打印器,通过管道连接到正确的收据打印机。我们手动将字符代码发送到打印机以创建粗体、下划线、字体更改等,因为客户要求我们这样做(有另一个应用程序使用这些字符代码,他们希望我们也使用它们) 。
如果您不想像我一样经历手动过程,那么 JavaPOS 是一个不错的选择。它有很多与打印到收据打印机相关的东西(绝对比我上面描述的要优雅得多)。您可以在 http://www.javapos.com/ 找到它。
I created an app to write to a receipt printer for a POS system a while back. The way we did it was to just open a printwriter that pipes to the correct receipt printer. We manually sent the character codes to the printer to create bold, underline, font changes, etc because of requirements from the client that we do it that way (there was another application that used these character codes and they wanted us to use them also).
If you don't want to go through the manual process like I did a good choice is JavaPOS. It has got alot of stuff related to printing to receipt printers (definately much more elegant than I described above). You'll find it at http://www.javapos.com/.