开发者

Getting the orientation of a PDF that has been read in through iText

开发者 https://www.devze.com 2023-03-16 23:00 出处:网络
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.

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()

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号