Skip to content

Commit

Permalink
2.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vfr committed Sep 16, 2014
1 parent 4da8d98 commit 93dbb7c
Show file tree
Hide file tree
Showing 18 changed files with 203 additions and 182 deletions.
7 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@

## History

2014-09-16: Version 2.8.1

- Replaced READER_ENABLE_MAIL with a canEmail document property.
- Replaced READER_ENABLE_EXPORT with a canExport document property.
- Replaced READER_ENABLE_PRINT with a canPrint document property.
- Compile time READER_FLAT_UI option now flattens the toolbars.

2014-09-14: Version 2.8.0

- Double-tap to zoom now centers the zoom on the location of the double-tap.
Expand Down
33 changes: 13 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ 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(s).

![iPod Page](http://i.imgur.com/wxC1B.png)<p></p>
![iPod Thumbs](http://i.imgur.com/4VNyQ.png)<p></p>
![iPad Page](http://i.imgur.com/T6nfI.png)<p></p>
![iPad Thumbs](http://i.imgur.com/wxQRC.png)
![iPod Page](http://i.imgur.com/GbjEQiC.png)<p></p>
![iPod Thumbs](http://i.imgur.com/kE5B5mb.png)<p></p>
![iPad Page](http://i.imgur.com/C7ULYUk.png)<p></p>
![iPad Thumbs](http://i.imgur.com/jc5PWth.png)

After launching the sample app, tap on the left hand side of the
screen to go back a page. Tap on the right hand side to go to the
Expand Down Expand Up @@ -123,21 +123,13 @@ all of the following iOS frameworks are required:

In ReaderConstants.h the following #define options are available:

`READER_FLAT_UI` - If TRUE, does not show button borders.
`READER_FLAT_UI` - If TRUE, follows the Fuglyosity of Flat Fad.

`READER_BOOKMARKS` - If TRUE, enables page bookmark support.

`READER_ENABLE_MAIL` - If TRUE, an email button is added to the toolbar
(if the device is properly configured for email support).

`READER_ENABLE_PRINT` - If TRUE, a print button is added to the toolbar
(if printing is supported and available on the device).

`READER_ENABLE_THUMBS` - If TRUE, a thumbs button is added to the toolbar
(enabling page thumbnail document navigation).
`READER_SHOW_SHADOWS` - If TRUE, a shadow is shown around each page
and page thumbnail.

`READER_ENABLE_EXPORT` - If TRUE, uses UIDocumentInteractionController
to be able to open up the current PDF in other iOS applications.
`READER_ENABLE_THUMBS` - If TRUE, a thumbs button is added to the main
toolbar enabling page thumbnail document navigation.

`READER_DISABLE_RETINA` - If TRUE, sets the CATiledLayer contentScale
to 1.0f. This effectively disables retina support and results in
Expand All @@ -150,13 +142,12 @@ is displayed before the CATiledLayer starts to render the PDF page.
`READER_DISABLE_IDLE` - If TRUE, the iOS idle timer is disabled while
viewing a document (beware of battery drain).

`READER_SHOW_SHADOWS` - If TRUE, a shadow is shown around each page
and the page content is inset by a couple of extra points.

`READER_STANDALONE` - If FALSE, a "Done" button is added to the toolbar
and the -dismissReaderViewController: delegate method is messaged when
it is tapped.

`READER_BOOKMARKS` - If TRUE, enables page bookmark support.

### ReaderDocument Archiving

To change where the property list for ReaderDocument objects is stored
Expand All @@ -172,6 +163,8 @@ Website: [http://www.vfr.org/](http://www.vfr.org/)

Email: joklamcak(at)gmail(dot)com

Twitter: @joklamcak

If you find this code useful, or wish to fund further development,
you can use PayPal to donate to the vfr-Reader project:

Expand Down
4 changes: 2 additions & 2 deletions Reader-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.8.0</string>
<string>2.8.1</string>
<key>CFBundleShortVersionString</key>
<string>2.8.0</string>
<string>2.8.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIPrerenderedIcon</key>
Expand Down
2 changes: 1 addition & 1 deletion Reader.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Reader'
s.version = '2.8.0'
s.version = '2.8.1'
s.license = 'MIT'
s.summary = 'The open source PDF file reader/viewer for iOS.'
s.homepage = 'http://www.vfr.org/'
Expand Down
Binary file modified Resources/Reader.pdf
Binary file not shown.
11 changes: 4 additions & 7 deletions Sources/ReaderConstants.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ReaderConstants.h
// Reader v2.8.0
// Reader v2.8.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2014 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -29,14 +29,11 @@

#import <Foundation/Foundation.h>

#define READER_FLAT_UI FALSE
#define READER_BOOKMARKS TRUE
#define READER_ENABLE_MAIL TRUE
#define READER_ENABLE_PRINT TRUE
#define READER_FLAT_UI TRUE
#define READER_SHOW_SHADOWS TRUE
#define READER_ENABLE_THUMBS TRUE
#define READER_ENABLE_EXPORT FALSE
#define READER_DISABLE_RETINA FALSE
#define READER_ENABLE_PREVIEW TRUE
#define READER_DISABLE_IDLE FALSE
#define READER_SHOW_SHADOWS TRUE
#define READER_STANDALONE FALSE
#define READER_BOOKMARKS TRUE
4 changes: 2 additions & 2 deletions Sources/ReaderConstants.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ReaderConstants.m
// Reader v2.8.0
// Reader v2.8.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2014 Julius Oklamcak. All rights reserved.
Expand All @@ -25,4 +25,4 @@

#import "ReaderConstants.h"

static NSString *const kReaderCopyrightNotice = @"Reader v2.x • Copyright © 2011-2014 Julius Oklamcak. All rights reserved.";
static NSString *const kReaderCopyrightNotice = @"Reader v2.x.y • Copyright © 2011-2014 Julius Oklamcak. All rights reserved.";
31 changes: 10 additions & 21 deletions Sources/ReaderContentPage.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ReaderContentPage.m
// Reader v2.8.0
// Reader v2.8.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2014 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -408,27 +408,16 @@ - (id)processSingleTap:(UITapGestureRecognizer *)recognizer

- (instancetype)initWithFrame:(CGRect)frame
{
id view = nil; // UIView

if (CGRectIsEmpty(frame) == false)
{
if ((self = [super initWithFrame:frame]))
{
self.autoresizesSubviews = NO;
self.userInteractionEnabled = NO;
self.contentMode = UIViewContentModeRedraw;
self.autoresizingMask = UIViewAutoresizingNone;
self.backgroundColor = [UIColor clearColor];

view = self; // Return self
}
}
else // Handle invalid frame size
if ((self = [super initWithFrame:frame]))
{
self = nil;
self.autoresizesSubviews = NO;
self.userInteractionEnabled = NO;
self.contentMode = UIViewContentModeRedraw;
self.autoresizingMask = UIViewAutoresizingNone;
self.backgroundColor = [UIColor clearColor];
}

return view;
return self;
}

- (instancetype)initWithURL:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phrase
Expand Down Expand Up @@ -505,9 +494,9 @@ - (instancetype)initWithURL:(NSURL *)fileURL page:(NSInteger)page password:(NSSt
NSAssert(NO, @"fileURL == nil");
}

id view = [self initWithFrame:viewRect]; // UIView setup
ReaderContentPage *view = [self initWithFrame:viewRect];

if (view != nil) [self buildAnnotationLinksList]; // Links
if (view != nil) [self buildAnnotationLinksList];

return view;
}
Expand Down
38 changes: 19 additions & 19 deletions Sources/ReaderContentView.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ReaderContentView.m
// Reader v2.8.0
// Reader v2.8.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2014 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -154,10 +154,10 @@ - (instancetype)initWithFrame:(CGRect)frame fileURL:(NSURL *)fileURL page:(NSUIn

[self updateMinimumMaximumZoom]; // Update the minimum and maximum zoom scales

self.zoomScale = self.minimumZoomScale; // Set zoom to fit page content
}
self.zoomScale = self.minimumZoomScale; // Set the zoom scale to fit page content

[self addObserver:self forKeyPath:@"frame" options:0 context:ReaderContentViewContext];
[self addObserver:self forKeyPath:@"frame" options:0 context:ReaderContentViewContext];
}

self.tag = page; // Tag the view with the page number
}
Expand All @@ -170,21 +170,6 @@ - (void)dealloc
[self removeObserver:self forKeyPath:@"frame" context:ReaderContentViewContext];
}

- (void)showPageThumb:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phrase guid:(NSString *)guid
{
#if (READER_ENABLE_PREVIEW == TRUE) // Option

CGSize size = ((userInterfaceIdiom == UIUserInterfaceIdiomPad) ? CGSizeMake(PAGE_THUMB_LARGE, PAGE_THUMB_LARGE) : CGSizeMake(PAGE_THUMB_SMALL, PAGE_THUMB_SMALL));

ReaderThumbRequest *request = [ReaderThumbRequest newForView:theThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];

UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:request priority:YES]; // Request the page thumb

if ([image isKindOfClass:[UIImage class]]) [theThumbView showImage:image]; // Show image from cache

#endif // end of READER_ENABLE_PREVIEW Option
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (context == ReaderContentViewContext) // Our context
Expand Down Expand Up @@ -219,6 +204,21 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
}
}

- (void)showPageThumb:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phrase guid:(NSString *)guid
{
#if (READER_ENABLE_PREVIEW == TRUE) // Option

CGSize size = ((userInterfaceIdiom == UIUserInterfaceIdiomPad) ? CGSizeMake(PAGE_THUMB_LARGE, PAGE_THUMB_LARGE) : CGSizeMake(PAGE_THUMB_SMALL, PAGE_THUMB_SMALL));

ReaderThumbRequest *request = [ReaderThumbRequest newForView:theThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];

UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:request priority:YES]; // Request the page thumb

if ([image isKindOfClass:[UIImage class]]) [theThumbView showImage:image]; // Show image from cache

#endif // end of READER_ENABLE_PREVIEW Option
}

- (id)processSingleTap:(UITapGestureRecognizer *)recognizer
{
return [theContentPage processSingleTap:recognizer];
Expand Down
6 changes: 5 additions & 1 deletion Sources/ReaderDocument.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ReaderDocument.h
// Reader v2.8.0
// Reader v2.8.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2014 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -38,6 +38,10 @@
@property (nonatomic, strong, readonly) NSString *password;
@property (nonatomic, strong, readonly) NSURL *fileURL;

@property (nonatomic, readonly) BOOL canEmail;
@property (nonatomic, readonly) BOOL canExport;
@property (nonatomic, readonly) BOOL canPrint;

+ (NSString *)documentsPath;

+ (ReaderDocument *)withDocumentFilePath:(NSString *)filename password:(NSString *)phrase;
Expand Down
18 changes: 17 additions & 1 deletion Sources/ReaderDocument.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ReaderDocument.m
// Reader v2.8.0
// Reader v2.8.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2014 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -71,6 +71,7 @@ @implementation ReaderDocument
@synthesize lastOpen = _lastOpen;
@synthesize password = _password;
@dynamic fileName, fileURL;
@dynamic canEmail, canExport, canPrint;

#pragma mark - ReaderDocument class methods

Expand Down Expand Up @@ -270,6 +271,21 @@ - (NSURL *)fileURL
return _fileURL;
}

- (BOOL)canEmail
{
return YES;
}

- (BOOL)canExport
{
return YES;
}

- (BOOL)canPrint
{
return YES;
}

- (BOOL)archiveDocumentProperties
{
NSString *archiveFilePath = [ReaderDocument archiveFilePath:[self fileName]];
Expand Down
33 changes: 24 additions & 9 deletions Sources/ReaderMainPagebar.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ReaderMainPagebar.m
// Reader v2.8.0
// Reader v2.8.1
//
// Created by Julius Oklamcak on 2011-09-01.
// Copyright © 2011-2014 Julius Oklamcak. All rights reserved.
Expand All @@ -23,6 +23,7 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#import "ReaderConstants.h"
#import "ReaderMainPagebar.h"
#import "ReaderThumbCache.h"
#import "ReaderDocument.h"
Expand Down Expand Up @@ -62,6 +63,8 @@ @implementation ReaderMainPagebar
#define PAGE_NUMBER_SPACE_SMALL 16.0f
#define PAGE_NUMBER_SPACE_LARGE 32.0f

#define SHADOW_HEIGHT 4.0f

#pragma mark - Properties

@synthesize delegate;
Expand All @@ -70,7 +73,11 @@ @implementation ReaderMainPagebar

+ (Class)layerClass
{
#if (READER_FLAT_UI == FALSE) // Option
return [CAGradientLayer class];
#else
return [CALayer class];
#endif // end of READER_FLAT_UI Option
}

#pragma mark - ReaderMainPagebar instance methods
Expand Down Expand Up @@ -146,18 +153,26 @@ - (instancetype)initWithFrame:(CGRect)frame document:(ReaderDocument *)object
self.userInteractionEnabled = YES;
self.contentMode = UIViewContentModeRedraw;
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
self.backgroundColor = [UIColor clearColor];

CAGradientLayer *layer = (CAGradientLayer *)self.layer;
UIColor *liteColor = [UIColor colorWithWhite:0.82f alpha:0.8f];
UIColor *darkColor = [UIColor colorWithWhite:0.32f alpha:0.8f];
layer.colors = [NSArray arrayWithObjects:(id)liteColor.CGColor, (id)darkColor.CGColor, nil];
if ([self.layer isKindOfClass:[CAGradientLayer class]])
{
self.backgroundColor = [UIColor clearColor];

CGRect shadowRect = self.bounds; shadowRect.size.height = 4.0f; shadowRect.origin.y -= shadowRect.size.height;
CAGradientLayer *layer = (CAGradientLayer *)self.layer;
UIColor *liteColor = [UIColor colorWithWhite:0.82f alpha:0.8f];
UIColor *darkColor = [UIColor colorWithWhite:0.32f alpha:0.8f];
layer.colors = [NSArray arrayWithObjects:(id)liteColor.CGColor, (id)darkColor.CGColor, nil];

ReaderPagebarShadow *shadowView = [[ReaderPagebarShadow alloc] initWithFrame:shadowRect];
CGRect shadowRect = self.bounds; shadowRect.size.height = SHADOW_HEIGHT; shadowRect.origin.y -= shadowRect.size.height;

[self addSubview:shadowView]; // Add the shadow to the view
ReaderPagebarShadow *shadowView = [[ReaderPagebarShadow alloc] initWithFrame:shadowRect];

[self addSubview:shadowView]; // Add shadow to toolbar
}
else // Follow The Fuglyosity of Flat Fad
{
self.backgroundColor = [UIColor colorWithWhite:0.94f alpha:0.96f];
}

CGFloat space = (([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ? PAGE_NUMBER_SPACE_LARGE : PAGE_NUMBER_SPACE_SMALL);
CGFloat numberY = (0.0f - (PAGE_NUMBER_HEIGHT + space)); CGFloat numberX = ((self.bounds.size.width - PAGE_NUMBER_WIDTH) * 0.5f);
Expand Down
Loading

0 comments on commit 93dbb7c

Please sign in to comment.