下面是代码:
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);
}
我想在打印之前显示打印服务。请为此帮助我,它可以打印页面,但不显示包含页面设置和份数等的打印服务。