Now available on GitHub is version 2.0 of the open source iOS PDF Reader/Viewer.
Version 2.0 is a complete rethink and rewrite of the original 1.x code.
The overall PDF reader/viewer functionality is encapsulated in a single ReaderViewController class. First, you initialize a ReaderDocument object with the file path to the PDF document (or unarchive an existing ReaderDocument object) and then initialize a ReaderViewController with this ReaderDocument object. The ReaderViewController class uses the ReaderDocument object to store information about the document and to keep track of document properties (i.e. current page).
An initialized ReaderViewController can then be presented modally, pushed onto a UINavigationController stack, or used as a root view controller. Please note that since ReaderViewController implements its own toolbar, you have to hide the UINavigationController’s navigation bar before pushing it and then show the navigation bar after popping it. The ReaderDemoController class shows how this is all done with a bundled PDF file.
Also implemented, and optionally enabled or disabled via compile time #define, is the emailing and printing of PDF documents.
Document navigation is very similar to iBooks: Tap on the left hand side of the screen to go back a page. Tap on the right hand side to go to the next page. You can also swipe left and right to change pages. Tap on the screen to fade in (or out) the toolbar and page slider. Double-tap with one finger (or pinch out) to zoom in. Double tap with two fingers (or pinch in) to zoom out.
The code is universal and does not require any XIBs (as all UI elements are code generated, allowing for greatest flexibility). It runs on iPad, iPhone and iPod touch with iOS 4.0 and up. Also supported are the Retina displays on iPhone 4 and iPod touch 4th generation and is ready to be fully internationalized. The idea was to provide a complete project template that you could start building from, or, just pull the required files into an existing project to enable PDF reading/viewing in your app.
This version has also been tested with large PDF files (over 250MB in size and over 2800 pages in length) and with PDF files of all flavors (from text only documents to graphics heavy magazines). It also works rather well on older devices (such as the iPod touch 2nd generation and iPhone 3G) and uses the dual-core processor (via CATiledLayer multi-threading) in the iPad 2.
This work is being made freely available under a Creative Commons Attribution License:
Enjoy!
