Hello,
Thanks for your feedback.
When testing your code in the web project, I did notice that the dialog box doesn't pop up. However, I tested the same code in a normal java project and found that it works well.
Meanwhile, I tested another open source PDF tool (code is as follows), and also used PrinterJob to print a PDF document, I found that the dialog box doesn't popup either. I'm afraid this is because the PrinterJob API does not support showing the dialog box in Web projects. Hope you can understand.
- Code: Select all
org.apache.pdfbox.pdmodel.PDDocument document = org.apache.pdfbox.pdmodel.PDDocument.load(new File("test.pdf"));
PrinterJob loPrinterJob = PrinterJob.getPrinterJob();
loPrinterJob.setPageable(new org.apache.pdfbox.printing.PDFPageable(document));
Boolean b=loPrinterJob.printDialog();
try {
loPrinterJob.print();
} catch (PrinterException e) {
e.printStackTrace();
}
Sincerely,
Elena
E-iceblue support team