 +}
 +
 +double SimpleDocument::GetPageWidth(int page) {
++  int rotate = doc_->getPageRotate(page);
++  if (rotate == 90 || rotate == 270)
++    return doc_->getPageCropHeight(page);
 +  return doc_->getPageCropWidth(page);
 +}
 +
 +double SimpleDocument::GetPageHeight(int page) {
++  int rotate = doc_->getPageRotate(page);
++  if (rotate == 90 || rotate == 270)
++    return doc_->getPageCropWidth(page);
 +  return doc_->getPageCropHeight(page);
 +}
 +

         globalParams = new GlobalParams();
         setErrorCallback(detail::error_function, NULL);
     }
@@ -662,3 +664,72 @@ document* document::load_from_raw_data(const char *file_data,
                                 owner_password, user_password);
     return document_private::check_document(doc, 0);
 }

 @BUILD_LIBTIFF_TRUE@libtiff_includes = $(LIBTIFF_CFLAGS)
 @BUILD_LIBOPENJPEG_TRUE@libjpeg2000_includes = $(LIBOPENJPEG_CFLAGS)
diff --git a/cpp/poppler-document.cpp b/cpp/poppler-document.cpp
index 1c24b47..732c252 100644
--- a/cpp/poppler-document.cpp
+++ b/cpp/poppler-document.cpp
@@ -30,6 +30,7 @@
