You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Eric Douglas <ed...@blockhouse.com> on 2011/03/03 21:36:36 UTC

Landscape

How do I use PDFBox to print Landscape??
I created a PDF object, I loaded it into PDFBox with PDDocument.load(),
and I saved it as a PDF from that object's save().  That made a
landscape PDF.  I can see the page showing upright with the height and
width reversed.
If I pass that (Pageable) PDDocument object to a PrinterJob I can send
that PDF to the printer but it prints straight up like I'm printing a
landscape document to a paper with portrait orientation so it cuts off
the edges.
How do I make it turn the printout on it's side (landscape)?

If I do the PDDocument's method getPageFormat().getOrientation() I get
the PageFormat.PORTRAIT value, though getWidth() is > getHeight().
Setting the Orientation property to LANDSCAPE in the
PrintRequestAttributeSet didn't help.  I don't see an easy way to change
the orientation in the PageFormat within the PDDocument.