You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Subbiah, Murugan" <mu...@sf.frb.org.INVALID> on 2020/08/20 22:24:23 UTC

Silent Printing PDF from server on the client side

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.