使用Java连接和打印到打印机 [英] Connecting and printing to a printer in Java
本文介绍了使用Java连接和打印到打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Java中有一种简单的方法可以执行以下操作吗?
Is there an easy way in Java to do the following?
- 连接到打印机(将是本地打印机并且是唯一的连接到机器的打印机。)
- 在2个不同的打印机托盘中打印2页的页面。
- 获取当前的打印队列数,即I有100个项目要打印,34个当前打印,打印机队列现在应该是66。
推荐答案
一些快速提示:
-
从java打印:参见基本打印程序
打印状态job:你可以通过使用 PrintJobListener :
status of printing job: you might be able to get something useful by using a PrintJobListener:
此监听器的实现
接口应附加到
DocPrintJob,以监控
打印机作业的状态。可以在处理打印作业的线程
或服务
创建的通知线程上调用这些回调
方法。在
的情况下,客户端不应在这些回调中执行
冗长的处理。
Implementations of this listener interface should be attached to a DocPrintJob to monitor the status of the printer job. These callback methods may be invoked on the thread processing the print job, or a service created notification thread. In either case the client should not perform lengthy processing in these callbacks.
这篇关于使用Java连接和打印到打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文