Get width/height of page with respect to orientation

I’m trying to get the dimensions of a page using getWidth() and getHeight(), but the width/height I get are the actual width and height of the page, not those relative to its orientation. Attached is an image that (hopefully) explains what I mean.

page-dimensions.png (4.9 KB)

How can I get the width/height of a specific page with respect to its orientation?

@mohammed.allulu

Would you please try to use page.getPageRect(true).getWidth(); to get the Width and page.getPageRect(true).getHeight(); to get the height of the page. In case you still notice any issues, please share your sample PDF with us. We will test the scenario in our environment and address it accordingly.

Thank you for your reply.

page.getRect() does not take a boolean type argument. However, I tried page.getPageRect(true) and that worked.

My issue has been resolved; thank you again.

@mohammed.allulu

It is good to know that your issue has been resolved. We have also edited our previous response according to correct information. Please keep using our API and feel free to create a new topic in case you need further assistance.