Getting the orientation of a PDF that has been read in through iText
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()
精彩评论