0
在此代码中,即使文件存在(并且我知道它没有密码保护),PSPDFDocument也显示为无效。不知道为什么会发生这种事尽管文件存在,但PSPDFKit文件无效
+ (PSPDFDocument *)fromDocument:(Document *)doc
{
NSString * path = [doc getFilePath];
PSPDFDocument * pspdfdoc = [PSPDFDocument documentWithURL:[NSURL fileURLWithPath:path]];
pspdfdoc.document = doc;
if ([pspdfdoc isValid])
DELogVerbose(@"Valid");
else
{
DELogVerbose(@"Not Valid");
NSFileManager *fileManager = [NSFileManager defaultManager];
DELogVerbose([fileManager fileExistsAtPath:path] ? @"File exists" : @"File does not exist");
}
return pspdfdoc;
}