NONCONFIDENTIAL // EXTERNAL
I built a PDF Box POC for silent printing. When I ran it in the local machine
everything worked perfectly. The same didn't work as expected when hosted on
the network server. My requirement is to print a PDF which is built on the
server side on the client's default printer. Below is the code which I used:
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
try (PDDocument doc = PDDocument.load(bais);) {
PrinterJob job = PrinterJob.getPrinterJob();
job.setPageable(new PDFPageable(doc));
job.print();
} catch (IOException | PrinterException ioe) {
ioe.printStackTrace();
}
Any help is appreciated!
Best Regards,
Murugan.