开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜