How to obtain PDF page orientation - landscape/portrait settings?

Q: We have implemented a search feature that places a rectangle around
all of the strings on a page that match a user specified string. This
works well in all cases except one. All is well when the page is in
portrait mode but when the page is in landscape mode there are a couple
of computations I must change. The problem is I don't know how to
check when a page is in Portrait vs. Landscape mode. I've looked
through your great examples and help but am unable to find a way that
works. Am I missing something? Any code snippets?


PDF format does not include a special property to setlandscape/portrait
mode, however there are couple of page properties that can be used for
similar purpose:

For example: page.GetRotation() returns the rotation value for the

Also, in case you would like to dynamically determine the
portrait/landscape mode, you could use
page.GetPageWidth()/page.GetPageHeight() (e.g. if
page.GetPageWidth()>page.GetPageHeight() -> use landscape mode,
otherwise use portrait mode).