I have a problem printing a landscape document (doc.width > doc.height)
. I have no problem with portrait. I'm using the PDFBox 1.8.2 library. It prints the document in portrait even if I set landscape mode manually like in this blog. There are several closed JIRA bugs about this problem in the PDFBox project. How do I print landscape?
Note: I've added extra PDF library tags to flag users of those libraries to see if this problem exists in those libraries.
Code from the blog post:
Version : PdfBox-1.7.1
PDDocument doc = PDDocument.load(psStream,true);
if (printService != null) {
PrinterJob pj = PrinterJob.getPrinterJob();
pj.defaultPage();
pj.setCopies(Integer.parseInt(finalnumberOfCopies));
pj.setPrintService(printService);
pj.setPageable(new MyPDPageable(doc,pj));
// don't use doc.silentPrint(pj) but pj.print() ...
pj.print();
}