Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version 2.5.5

  • Loading branch information...
commit 01645e9239060b83a0cadb90db14cf127d3a24a3 1 parent a201ec7
Julius Oklamcak vfr authored
BIN  Graphics/AppIcon-057.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  Graphics/AppIcon-114.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  Graphics/AppIcon-144.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 README
View
@@ -13,11 +13,11 @@ any bugs or have questions about the code.
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(s).
+supported are the Retina displays in all new devices 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(s).
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
@@ -31,7 +31,7 @@ This implementation has been tested with large PDF files (over
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 takes advantage of the dual-core
-processor (via CATiledLayer and multi-threading) in the iPad 2.
+processor (via CATiledLayer and multi-threading) in new devices.
FEATURES
========
@@ -40,7 +40,7 @@ Multithreaded: The UI is always quite smooth and responsive.
Supports:
- - iBooks like document navigation.
+ - iBooks-like document navigation.
- Device rotation and all orientations.¹
- Encrypted (password protected) PDFs.
- PDF links (URI and go to page).
@@ -51,7 +51,7 @@ NOTES
Version 2.x of the PDF reader/viewer code was originally developed
and tested under Xcode 3.2.6, LLVM 1.7, iOS 4.3.5, iOS 4.2.1 with
-current development and testing under Xcode 4.2, LLVM 3.0, iOS 5.
+current development and testing under Xcode 4.3, Clang 3.1, iOS 5.
The code uses manual memory management and will continue to do so.
The overall PDF reader/viewer functionality is encapsulated in the
@@ -99,6 +99,8 @@ reader/viewer into one of your projects:
ThumbsMainToolbar.h ThumbsMainToolbar.m
UIXToolbarView.h UIXToolbarView.m
+ Reader-Button-H.png Reader-Button-H@2x.png
+ Reader-Button-N.png Reader-Button-N@2x.png
Reader-Email.png Reader-Email@2x.png
Reader-Mark-N.png Reader-Mark-N@2x.png
Reader-Mark-Y.png Reader-Mark-Y@2x.png
@@ -216,6 +218,12 @@ HISTORY
- Bug fix to PDF link handling in older format PDFs.
- Changed from CC BY 3.0 License to MIT License.
+2012-04-10: Version 2.5.5
+
+ - Handles PDF web links without http:// as the prefix.
+ - Bug fix to PDF link handling with cropboxed PDF files.
+ - Some performance improvements on iPad 3rd generation.
+
CONTACT INFO
============
5 Reader-Info.plist
View
@@ -8,6 +8,7 @@
<string>en</string>
<key>CFBundleIconFiles</key>
<array>
+ <string>AppIcon-144.png</string>
<string>AppIcon-114.png</string>
<string>AppIcon-072.png</string>
<string>AppIcon-057.png</string>
@@ -25,7 +26,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>2.5.4</string>
+ <string>2.5.5</string>
+ <key>CFBundleShortVersionString</key>
+ <string>2.5.5</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIPrerenderedIcon</key>
8 Reader.xcodeproj/project.pbxproj
View
@@ -19,6 +19,7 @@
455C789E14268F6A0053D73B /* Reader-Button-H@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 455C789A14268F6A0053D73B /* Reader-Button-H@2x.png */; };
455C789F14268F6A0053D73B /* Reader-Button-N.png in Resources */ = {isa = PBXBuildFile; fileRef = 455C789B14268F6A0053D73B /* Reader-Button-N.png */; };
455C78A014268F6A0053D73B /* Reader-Button-N@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 455C789C14268F6A0053D73B /* Reader-Button-N@2x.png */; };
+ 4583767F1533B0AC003CD230 /* AppIcon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = 4583767E1533B0AC003CD230 /* AppIcon-144.png */; };
458DDFD7140D45FA00C5DA94 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 458DDFD6140D45FA00C5DA94 /* ImageIO.framework */; };
45AB72C6141FBFCA003524C3 /* AppIcon-057.png in Resources */ = {isa = PBXBuildFile; fileRef = 45AB72B9141FBFCA003524C3 /* AppIcon-057.png */; };
45AB72C7141FBFCA003524C3 /* AppIcon-072.png in Resources */ = {isa = PBXBuildFile; fileRef = 45AB72BA141FBFCA003524C3 /* AppIcon-072.png */; };
@@ -76,6 +77,7 @@
455C789A14268F6A0053D73B /* Reader-Button-H@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Reader-Button-H@2x.png"; path = "Graphics/Reader-Button-H@2x.png"; sourceTree = "<group>"; };
455C789B14268F6A0053D73B /* Reader-Button-N.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Reader-Button-N.png"; path = "Graphics/Reader-Button-N.png"; sourceTree = "<group>"; };
455C789C14268F6A0053D73B /* Reader-Button-N@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Reader-Button-N@2x.png"; path = "Graphics/Reader-Button-N@2x.png"; sourceTree = "<group>"; };
+ 4583767E1533B0AC003CD230 /* AppIcon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "AppIcon-144.png"; path = "Graphics/AppIcon-144.png"; sourceTree = "<group>"; };
458BF155143E077500CDF567 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = Resources/de.lproj/Localizable.strings; sourceTree = "<group>"; };
458DDFD6140D45FA00C5DA94 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
45AB72B9141FBFCA003524C3 /* AppIcon-057.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "AppIcon-057.png"; path = "Graphics/AppIcon-057.png"; sourceTree = "<group>"; };
@@ -143,8 +145,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */,
450A670411D27B9D00014BF5 /* QuartzCore.framework in Frameworks */,
45BD5AFE13AE721A00D6FE97 /* MessageUI.framework in Frameworks */,
@@ -242,6 +244,7 @@
45AB72C3141FBFCA003524C3 /* Reader-Print@2x.png */,
45AB72C4141FBFCA003524C3 /* Reader-Thumbs.png */,
45AB72C5141FBFCA003524C3 /* Reader-Thumbs@2x.png */,
+ 4583767E1533B0AC003CD230 /* AppIcon-144.png */,
45AB72BB141FBFCA003524C3 /* AppIcon-114.png */,
45AB72BA141FBFCA003524C3 /* AppIcon-072.png */,
45AB72B9141FBFCA003524C3 /* AppIcon-057.png */,
@@ -327,7 +330,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0420;
+ LastUpgradeCheck = 0430;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Reader" */;
compatibilityVersion = "Xcode 3.2";
@@ -374,6 +377,7 @@
455C789E14268F6A0053D73B /* Reader-Button-H@2x.png in Resources */,
455C789F14268F6A0053D73B /* Reader-Button-N.png in Resources */,
455C78A014268F6A0053D73B /* Reader-Button-N@2x.png in Resources */,
+ 4583767F1533B0AC003CD230 /* AppIcon-144.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BIN  Resources/Reader.pdf
View
Binary file not shown
7 Sources/ReaderContentPage.h
View
@@ -1,6 +1,6 @@
//
// ReaderContentPage.h
-// Reader v2.5.4
+// Reader v2.5.5
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -37,7 +37,10 @@
NSInteger _pageAngle;
- CGSize _pageSize;
+ CGFloat _pageWidth;
+ CGFloat _pageHeight;
+ CGFloat _pageOffsetX;
+ CGFloat _pageOffsetY;
}
- (id)initWithURL:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phrase;
31 Sources/ReaderContentPage.m
View
@@ -1,6 +1,6 @@
//
// ReaderContentPage.m
-// Reader v2.5.4
+// Reader v2.5.5
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -96,6 +96,9 @@ - (ReaderDocumentLink *)linkFromAnnotation:(CGPDFDictionaryRef)annotationDiction
if (ll_x > ur_x) { CGPDFReal t = ll_x; ll_x = ur_x; ur_x = t; } // Normalize Xs
if (ll_y > ur_y) { CGPDFReal t = ll_y; ll_y = ur_y; ur_y = t; } // Normalize Ys
+ ll_x -= _pageOffsetX; ll_y -= _pageOffsetY; // Offset lower-left co-ordinate
+ ur_x -= _pageOffsetX; ur_y -= _pageOffsetY; // Offset upper-right co-ordinate
+
switch (_pageAngle) // Page rotation angle (in degrees)
{
case 90: // 90 degree page rotation
@@ -111,15 +114,15 @@ - (ReaderDocumentLink *)linkFromAnnotation:(CGPDFDictionaryRef)annotationDiction
CGPDFReal swap;
swap = ll_y; ll_y = ll_x; ll_x = swap;
swap = ur_y; ur_y = ur_x; ur_x = swap;
- ll_x = ((0.0f - ll_x) + _pageSize.width);
- ur_x = ((0.0f - ur_x) + _pageSize.width);
+ ll_x = ((0.0f - ll_x) + _pageWidth);
+ ur_x = ((0.0f - ur_x) + _pageWidth);
break;
}
case 0: // 0 degree page rotation
{
- ll_y = ((0.0f - ll_y) + _pageSize.height);
- ur_y = ((0.0f - ur_y) + _pageSize.height);
+ ll_y = ((0.0f - ll_y) + _pageHeight);
+ ur_y = ((0.0f - ur_y) + _pageHeight);
break;
}
}
@@ -483,21 +486,25 @@ - (id)initWithURL:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phr
default: // Default case
case 0: case 180: // 0 and 180 degrees
{
- _pageSize.width = effectiveRect.size.width;
- _pageSize.height = effectiveRect.size.height;
+ _pageWidth = effectiveRect.size.width;
+ _pageHeight = effectiveRect.size.height;
+ _pageOffsetX = effectiveRect.origin.x;
+ _pageOffsetY = effectiveRect.origin.y;
break;
}
case 90: case 270: // 90 and 270 degrees
{
- _pageSize.height = effectiveRect.size.width;
- _pageSize.width = effectiveRect.size.height;
+ _pageWidth = effectiveRect.size.height;
+ _pageHeight = effectiveRect.size.width;
+ _pageOffsetX = effectiveRect.origin.y;
+ _pageOffsetY = effectiveRect.origin.x;
break;
}
}
- NSInteger page_w = _pageSize.width; // Integer width
- NSInteger page_h = _pageSize.height; // Integer height
+ NSInteger page_w = _pageWidth; // Integer width
+ NSInteger page_h = _pageHeight; // Integer height
if (page_w % 2) page_w--; if (page_h % 2) page_h--; // Even
@@ -573,6 +580,8 @@ - (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context
drawPDFPageRef = CGPDFPageRetain(_PDFPageRef);
}
+ //NSLog(@"%s %@", __FUNCTION__, NSStringFromCGRect(CGContextGetClipBoundingBox(context)));
+
CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // White
CGContextFillRect(context, CGContextGetClipBoundingBox(context)); // Fill
12 Sources/ReaderContentTile.m
View
@@ -1,6 +1,6 @@
//
// ReaderContentTile.m
-// Reader v2.5.4
+// Reader v2.5.5
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -59,15 +59,15 @@ - (id)init
if ((self = [super init]))
{
- self.levelsOfDetail = LEVELS_OF_DETAIL;
+ self.levelsOfDetail = LEVELS_OF_DETAIL; // Zoom (?) levels
- self.levelsOfDetailBias = LEVELS_OF_DETAIL_BIAS;
+ UIScreen *mainScreen = [UIScreen mainScreen]; // Main screen
- UIScreen *mainScreen = [UIScreen mainScreen]; // Screen
+ CGFloat screenScale = [mainScreen scale]; // Main screen scale
- CGFloat screenScale = [mainScreen scale]; // Screen scale
+ self.levelsOfDetailBias = (screenScale > 1.0f) ? 1 : LEVELS_OF_DETAIL_BIAS;
- CGRect screenBounds = [mainScreen bounds]; // Screen bounds
+ CGRect screenBounds = [mainScreen bounds]; // Main screen bounds
CGFloat w_pixels = (screenBounds.size.width * screenScale);
4 Sources/ReaderContentView.m
View
@@ -1,6 +1,6 @@
//
// ReaderContentView.m
-// Reader v2.5.4
+// Reader v2.5.5
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -131,7 +131,7 @@ - (id)initWithFrame:(CGRect)frame fileURL:(NSURL *)fileURL page:(NSUInteger)page
self.zoomScale = self.minimumZoomScale; // Set zoom to fit page content
}
- [self addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:NULL];
+ [self addObserver:self forKeyPath:@"frame" options:0 context:NULL];
self.tag = page; // Tag the view with the page number
}
2  Sources/ReaderDocument.m
View
@@ -163,7 +163,7 @@ + (ReaderDocument *)unarchiveFromFileName:(NSString *)filename password:(NSStrin
return document;
}
-+ (ReaderDocument *)withDocumentFilePath:(NSString *)filePath password:(NSString *)phrase;
++ (ReaderDocument *)withDocumentFilePath:(NSString *)filePath password:(NSString *)phrase
{
#ifdef DEBUGX
NSLog(@"%s", __FUNCTION__);
4 Sources/ReaderThumbView.m
View
@@ -1,6 +1,6 @@
//
// ReaderThumbView.m
-// Reader v2.5.4
+// Reader v2.5.5
//
// Created by Julius Oklamcak on 2011-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -54,7 +54,7 @@ - (id)initWithFrame:(CGRect)frame
imageView.userInteractionEnabled = NO;
imageView.contentMode = UIViewContentModeScaleAspectFit;
imageView.autoresizingMask = UIViewAutoresizingNone;
- imageView.backgroundColor = [UIColor clearColor];
+ //imageView.backgroundColor = [UIColor clearColor];
[self addSubview:imageView];
}
23 Sources/ReaderViewController.m
View
@@ -1,6 +1,6 @@
//
// ReaderViewController.m
-// Reader v2.5.4
+// Reader v2.5.5
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -662,7 +662,26 @@ - (void)handleSingleTap:(UITapGestureRecognizer *)recognizer
{
if ([target isKindOfClass:[NSURL class]]) // Open a URL
{
- [[UIApplication sharedApplication] openURL:target];
+ NSURL *url = (NSURL *)target; // Cast to a NSURL object
+
+ if (url.scheme == nil) // Handle a missing URL scheme
+ {
+ NSString *www = url.absoluteString; // Get URL string
+
+ if ([www hasPrefix:@"www"] == YES) // Check for 'www' prefix
+ {
+ NSString *http = [NSString stringWithFormat:@"http://%@", www];
+
+ url = [NSURL URLWithString:http]; // Proper http-based URL
+ }
+ }
+
+ if ([[UIApplication sharedApplication] openURL:url] == NO)
+ {
+ #ifdef DEBUG
+ NSLog(@"%s '%@'", __FUNCTION__, url); // Bad or unknown URL
+ #endif
+ }
}
else // Not a URL, so check for other possible object type
{
Please sign in to comment.
Something went wrong with that request. Please try again.