2016-01-20 92 views
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; 
} 

回答

0

由于我们已经回答了这个对我们的支持门户网站,我也想在这里写一个小的书面记录。 PDF受密码保护,所以虽然设置和路径是正确的,但isValid返回false,直到使用正确的密码解锁文档。 (通过unlockWithPassword:

相关问题