Pdf in Landscape using pdfBox

Raushan picture Raushan · May 31, 2016 · Viewed 16.2k times · Source

Currently I am working with PDFBox of Apache to generate pdf. It is working perfectly fine in portrait mode but then my requirement is that 1st two page should be in landscape mode and afterwards all other pages in portrait.

So can anyone please help me on how to create pdf in landscape and achieve this functionality??

Note:I cannot switch from PDFBox to other libraries

Answer

wutzebaer picture wutzebaer · Oct 20, 2016

Another solution would be

PDPage page = new PDPage(new PDRectangle(PDRectangle.A4.getHeight(), PDRectangle.A4.getWidth()));