I’m using Apple’s example «PDFScrollView» to display PDFs on an iPad. This works fine, as long as the PDF-document is in Portrait-Mode.
When the document is in Landscape-mode, though, the document is always shown rotated by 90 degrees.
I found this How to detect the orientation of a PDF document in iPhone SDK – but when I try to get the dimensions of the PDF, the height is always bigger than the width, no matter what orientation the PDF has…
Any ideas?
As mentionend in, the
CGPDFPageGetBoxRect(page, kCGPDFMediaBox)always returns the same size for a PDF, no matter what orientation the PDF has.But the rotation of the page is returned correctly.
So I get the rotation using this code:
And then use the code below which I found here: http://ipdfdev.com/2011/03/23/display-a-pdf-page-on-the-iphone-and-ipad/
Et voilà – the PDF is displayed in the right orientation