使用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];
}
答案 0 :(得分:0)
您发布的代码不使用PSPDFKit PDF SDK。 您将文件加载到内存中,构建另一个文件路径并将加载的文件存储到该路径中。
如果您共享用于创建文件的PSPDFKit API代码,我很乐意仔细查看并帮助您调试此问题。
作为附加数据点,您还可以比较通过iOS Safari(使用Apple内部渲染器)加载PDF,然后将其与PDF Viewer by PSPDFKit进行比较,我们的免费应用程序可用于iOS和Android,其中包括我们自己的专有渲染引擎。
PSPDFKit是一个商业SDK,用于注释文档,填写表单以及创建PDF文档。我们为客户提供商业支持,包括评估许可证和许可证所有者。请将您的机票报告给我们的support page - 谢谢!
注意:由于我们在iOS,Android,Web,Web Standalone,macOS和Windows上都可用,请详细说明您在哪个平台以及您创建文档的版本 - 许多组合,我们希望有效地帮助您。 / p>
编辑:感谢您添加代码并将其提交给我们的支持。这是与Third-Party Compatibility相关的问题,它可以使用兼容的PDF渲染器,例如Adobe Acrobat。