0

使用 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];


}
4

1 回答 1

0

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

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

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

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

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

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

于 2018-01-10T17:35:47.283 回答