I am reading in a PDF through iText. How can I check to see if the orientation of the first page is in landscape or portrait mode?
I'm using this and it seems to work well.
Rectangle rectangle = pdfReader.getPageSizeWithRotation(pageNumber);
if(rectangle.getHeight() >= rectangle.getWidth())
return PageFormat.PORTRAIT;
else
return PageFormat.LANDSCAPE;
Try getPageRotation()
combined with getPageSize()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With