【问题标题】:PSPDFKIt Created PDF not opening in ios safari browserPSPDFKIt 创建的 PDF 无法在 ios Safari 浏览器中打开
【发布时间】:2018-01-10 16:05:27
【问题描述】:

使用 PSPDFkit 7.0 版本,我创建了 PDF 文件。

此文件在所有浏览器和 PDF 查看器应用程序中都能完美运行。但一个问题是 IOS 设备浏览器 safari、Chrome 和 Firefox 没有显示此文档。它显示的是空文档。

但是当我在 iBook、文件浏览器和其他 PDF 查看器应用程序中打开此 pdf 文件时,它运行良好。

我的代码如下:

- (void)pdfDocumentDidSave:(PSPDFDocument *)document {
    NSLog(@"Successfully saved document.");

            //Get path directory
            NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
            NSString *documentsDirectory = [paths objectAtIndex:0];

            //Create PDF_Documents directory
            documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"PDF_Documents"];
            [[NSFileManager defaultManager] createDirectoryAtPath:documentsDirectory withIntermediateDirectories:YES attributes:nil error:nil];

            NSString *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory, @"hello123.pdf"];


    // Create default configuration
    PSPDFProcessorConfiguration *configuration = [[PSPDFProcessorConfiguration alloc] initWithDocument:document];

[configuration modifyAnnotationsOfTypes:PSPDFAnnotationTypeAll change:PSPDFAnnotationChangeEmbed];


    // Start the conversion from `document` to `scaledDocumentURL`
    [PSPDFProcessor generatePDFFromConfiguration:configuration securityOptions:nil outputFileURL:[NSURL URLWithString:filePath] progressBlock:nil error:NULL];


}

【问题讨论】:

    标签: ios objective-c pdf-viewer pspdfkit


    【解决方案1】:

    您发布的代码未使用PSPDFKit PDF SDK。 您将文件加载到内存中,构建另一个文件路径并将加载的文件存储到该路径中。

    如果您共享用于创建文件的 PSPDFKit API 代码,我很乐意仔细查看并帮助您调试此问题。

    作为附加数据点,您还可以比较通过使用 Apple 内部渲染器的 iOS Safari 加载 PDF,然后将其与 PDF Viewer by PSPDFKit 进行比较,我们的免费应用程序可用于 iOS 和 Android,包括我们自己的专有渲染引擎.

    PSPDFKit 是一个商业 SDK,用于注释文档、填写表格以及创建 PDF 文档。我们为评估许可证的客户和许可证所有者提供商业支持。请将您的票报告给我们的support page - 谢谢!

    注意:由于我们在 iOS、Android、Web、Web Standalone、macOS 和 Windows 上可用,还请详细说明您创建文档的平台和版本 - 多种组合,我们希望有效地帮助您。

    编辑:感谢您添加代码并将其提交给我们的支持。这是一个与 Third-Party Compatibility 相关的问题,它可以使用兼容的 PDF 渲染器(例如 Adob​​e Acrobat)工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-29
      • 2013-08-02
      相关资源
      最近更新 更多