ios - CGPDFDocumentCreateWithURL 在任何 PDF 文件上返回 nil

标签 ios swift pdf

我不明白为什么 * CGPDFDocumentCreateWithURL* 返回 nil。该文件未加密,没有密码,是一个带有文本内容的简单 pdf。是什么原因造成的。

var pdfDoc: CGPDFDocument!

pdfDoc = CGPDFDocumentCreateWithURL(url)// the value is nil even though url and pdf file are valid
let pdfCatalog=CGPDFDocumentGetCatalog(pdfDoc)

请注意文件确实存在且url有效

最佳答案

通过在路径中添加“file:///”解决了问题。 https://forums.developer.apple.com/message/113941#113941

关于ios - CGPDFDocumentCreateWithURL 在任何 PDF 文件上返回 nil,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35392218/

相关文章:

pdf - 如何通过xpdf或mupdf获取指定的文本pos?

android - 如何为ibeacons设置坐标?

swift - 导出与旧版本兼容的 OS X 应用程序

swift - 获取 iCloud 用户的年龄和性别

ios - 自定义 UITableViewCell 中的 UILabels 未在屏幕上呈现

php - 使用 TCPDF 创建大型 PDF 的最有效方法是什么?

java - 如何管理 LocalConverter 以及何时调用 ShutDown() 方法?

ios - UINavigationBar 右键太高

ios - 滚动时 UITableView 奇怪的布局行为发生变化

ios - Swift 3 中的 Hashids.org 不工作