/Reader

PDF Reader Core for iOS

Primary LanguageObjective-CMIT LicenseMIT

PDF Reader Core for iOS 7

Introduction

I loved the original version of this project. It was the only decent open source PDF reader for iOS. The one caveat for me was its incredibly dated UI. So with this in mind, I forked the project and optimised the UI for iOS 7 and added a few more necessary tweaks.

What's New

Here's a list of the changes I've made for the initial version:

  • Optimised UI for iOS 7 style.
  • Implemented fast pagination as per this pull request.
  • Ditched the ReaderMainToolbar for the top toolbar. The viewer now uses the current UINavigationController's nav bar. Note: this means the the viewer is required to be shown in a UINavigationController isntance. See below.
  • Ditched cluttered bar button items in favor of two UIBarButtonItems.
  • Added ability to open PDF in other apps.
  • Moved all framework files into dedicated folder (ReaderFramework).
  • Moved assets into Reader.bundle file in /ReaderFramework.
  • Added UIPopover approach for iPad actions (see here).

Here's how it looks now:

iPod Page iPod Page iPod Page

Installation

Cocoapods of course!

pod 'ReaderFramework', '~> 1.0.0'

Usage

As mentioned above, you now need to show the ReaderViewController instance in UINavigationController stack. So if you want to push it onto the stack, simply:

-(void)pushShowPDFReader:(id)sender {
	NSString *filePath = [[NSBundle mainBundle] pathForResource:@"mydocument" ofType:@"pdf"];
	ReaderDocument *document = [ReaderDocument withDocumentFilePath:filePath password:phrase];

	ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document];
	readerViewController.delegate = self;
	
	[self.navigationController pushViewController:readerViewController animated:YES];
}

You can also display it modally, but you need to show it in a UINavigationController:

-(void)pushShowPDFReaderModally:(id)sender {
	NSString *filePath = [[NSBundle mainBundle] pathForResource:@"mydocument" ofType:@"pdf"];
	ReaderDocument *document = [ReaderDocument withDocumentFilePath:filePath password:phrase];

	ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document];
	readerViewController.delegate = self;
	
	UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:readerViewController];
		
	[self presentViewController:navigationController animated:YES completion:nil];
}

Acknowledgements

This is a fork of Julius Oklamcak's Reader project, so full credit to him for the base work.

License

This code has been made available under the MIT License.