March 23rd, 2011
Displaying a PDF page in an iPhone/iPad application seems pretty simple since the iOS includes a PDF API but there a few pitfalls. The iOS SDK includes the ZoomingPDFViewer sample and there are also several examples on the internet that show how to do this. The thing with Apple’s ZoomingPDFViewer and the other examples is that they have several flaws: rotated pages are not handled correctly, the actual position of MediaBox and CropBox is not considered, they cannot scale higher than 100% and they do not clip the content relative to CropBox as any PDF viewer does. The test files available for download at the end of this article let you verify these issues.
This article will show how to take care of the above problems and display a PDF page at a specific position in the view with a user defined zoom level.