在此代码中,即使文件存在,PSPDFDocument 也显示为无效(而且我知道它不受密码保护)。不知道为什么会发生这种情况
+ (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;
}