【问题标题】:PSPDFKit document not valid although file existsPSPDFKit 文档无效,但文件存在
【发布时间】:2016-01-20 21:21:31
【问题描述】:

在此代码中,即使文件存在,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;
}

【问题讨论】:

    标签: ios objective-c pspdfkit


    【解决方案1】:

    因为我们已经在我们的支持门户网站上回答了这个问题,所以我还想在这里写一篇小文章。 PDF 受密码保护,因此当设置和路径正确时,isValid 返回false,直到使用正确密码解锁文档。 (通过unlockWithPassword:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-19
      • 1970-01-01
      • 1970-01-01
      • 2012-09-21
      • 2019-09-01
      • 1970-01-01
      相关资源
      最近更新 更多