发现默认打印服务
要发现默认打印服务,我们可以使用 PrintServiceLookup
类。让我们看看如何::
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
public class DiscoveringDefaultPrintService {
public static void main(String[] args) {
discoverDefaultPrintService();
}
public static void discoverDefaultPrintService() {
PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
System.out.println("Default print service name: " + defaultPrintService.getName());
}
}