高分求解:java中调用的打印机在什么情况下不可用?

来源:百度知道 编辑:UC知道 时间:2024/06/05 22:10:12
java文档中说PrinterJob类中的getPrinterJob()方法无论返回的打印机是否可用都不会返回一个null值。我查阅过一些文献有介绍说可以用getPrintService()方法测试返回的数值是否为null来判断打印机是否可用。
但是我不明白的是,在什么情况下打印机不可用?高分求解详细的解答。

java文档参考原文:
PrinterJob java.awt.print.PrinterJob.getPrinterJob()
"
Creates and returns a PrinterJob which is initially associated with the default printer. If no printers are available on the system, a PrinterJob will still be returned from this method, but getPrintService() will return null, and calling print with this PrinterJob might generate an exception. Applications that need to determine if there are suitable printers before creating a PrinterJob should ensure that the array returned from lookupPrintServices is not empty.
"
相关文档原文参考:
"
One point you should keep in mind is that sometimes a printer may not be available on the machine on which your code is running.In this case the getPrintService() method will return null,so it's a good idea to call the metho

我没做过这,凭想像我觉得有以下几点:
1.与打印机的链接问题
2.打印机没有纸(不知道这个算不算)

不可用的情况就是打印机没有安装好..

打印机坏的时候。。。