输出显示“ java.awt.print.PrinterException:服务不能为空”任何解决方案?

时间:2018-06-27 10:26:25

标签: java swing netbeans

下面是代码:

try {
  PDDocument pdf = PDDocument.load(new File(filename));
  PrinterJob job = PrinterJob.getPrinterJob();
  job.setPageable(new PDFPageable(pdf));
  PrintService myPrintService = null;
  job.setPrintService(myPrintService);
  job.print();
} catch (IOException | NullPointerException | PrinterException e) {
  System.out.println(e);
}

我想在打印之前显示打印服务。请为此帮助我,它可以打印页面,但不显示包含页面设置和份数等的打印服务。

0 个答案:

没有答案