Skip to content

Commit bcbba65

Browse files
author
RadAzzouz
committed
Add the ability to present Image Documents
1 parent 0170e8b commit bcbba65

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
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
};
313 KB
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

0 commit comments

Comments
 (0)