Skip to content

Commit c6d0ad1

Browse files
authored
Merge pull request #63 from PSPDFKit/rad/image-documents
Adds the ability to present Image Documents
2 parents 0170e8b + a418bc7 commit c6d0ad1

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

CordovaDemo/platforms/ios/CordovaDemo.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@
396396
GCC_THUMB_SUPPORT = NO;
397397
GCC_VERSION = "";
398398
INFOPLIST_FILE = "CordovaDemo/CordovaDemo-Info.plist";
399-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
399+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
400400
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
401401
PRODUCT_NAME = CordovaDemo;
402402
};
@@ -420,7 +420,7 @@
420420
GCC_THUMB_SUPPORT = NO;
421421
GCC_VERSION = "";
422422
INFOPLIST_FILE = "CordovaDemo/CordovaDemo-Info.plist";
423-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
423+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
424424
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
425425
PRODUCT_NAME = CordovaDemo;
426426
};
Loading
313 KB
Loading

PSPDFKitPlugin/PSPDFKitPlugin.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,11 @@ - (NSURL *)pdfFileURLWithPath:(NSString *)path
410410
return nil;
411411
}
412412

413+
- (BOOL)isImagePath:(NSString *)path {
414+
NSString *pathExtension = path.pathExtension.lowercaseString;
415+
return [pathExtension isEqualToString:@"png"] || [pathExtension isEqualToString:@"jpeg"] || [pathExtension isEqualToString:@"jpg"];
416+
}
417+
413418
- (NSInteger)enumValueForKey:(NSString *)key ofType:(NSString *)type withDefault:(int)defaultValue
414419
{
415420
NSNumber *number = key? [self enumValuesOfType:type][key]: nil;
@@ -1010,7 +1015,12 @@ - (void)present:(CDVInvokedUrlCommand *)command {
10101015
if (path) {
10111016
//configure document
10121017
NSURL *url = [self pdfFileURLWithPath:path];
1013-
_pdfDocument = [[PSPDFDocument alloc] initWithURL:url];
1018+
if ([self isImagePath:path]) {
1019+
_pdfDocument = [[PSPDFImageDocument alloc] initWithImageURL:url];
1020+
}
1021+
else {
1022+
_pdfDocument = [[PSPDFDocument alloc] initWithURL:url];
1023+
}
10141024
[self setOptions:newOptions forObject:_pdfDocument animated:NO];
10151025
}
10161026

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pspdfkit-cordova-ios",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "PSPDFKit Cordova Plugin for iOS",
55
"cordova": {
66
"id": "pspdfkit-cordova-ios",

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<plugin id="pspdfkit-cordova-ios" version="1.2.2" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2+
<plugin id="pspdfkit-cordova-ios" version="1.2.3" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
33
<engines>
44
<engine name="cordova" version=">=6.3.1"/>
55
</engines>

0 commit comments

Comments
 (0)