We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to get full page size?

The documentation for Page.Rect says:

Page crop box is returned if specified, otherwise page media box is returned.

How do you get the full size of a page ignoring crop and media boxes?


Thanks for contacting support.

The actual page size is used to be its media box. In other words, there is no actual page size other than media box and it is always present in the PDF. In order to get size of page you may use following code:

Rectangle rect  = page.getMediaBox();

OR Page.PageInfo.Width and Page.PageInfo.Height also returns height/width of media box:


Furthermore, Page.Rect returns rectangle of the page which takes crop box into consideration. In case crop box is not present, it will consider media box. We hope this information will be helpful. In case of any other inquiry, please feel free to let us know.