我有一个技术图纸的 PDF 文件,其中包含一个页面,其中包含链接到文档特定区域的书签。
当我在 Adobe Reader 或 Foxit Reader 中单击这些书签时,它会放大到这个指定区域。但在 Apple 的 Preview.app 或 iBooks 或基于 PDFKit 的 iOS 应用程序中,它将无法工作。甚至 PSPDFKit 也无法处理这些书签。
我正在构建一个PDFView
可以处理这些书签的基于 iOS 的应用程序。当我调试PDFOutline
属性时,我可以看到包含PDFDestination
的对象包含信息,但在私有字段中。我可以在调试期间观看它们。
此外,当我访问对象的description
属性时PDFDestination
,我得到以下信息:
FitR, page = 0, l = 132.0, b = 451.0, r = 400.0, t = 724.0
但是值zoom
和point
返回3.40282347e+38F
值是 32 位系统上的最大值,CGFloat
这意味着它们没有正确设置。
PDFView
配置
这是更多代码,显示了我如何配置我的PDFView
pdfView.document = document
pdfView.displayDirection = .horizontal
pdfView.autoScales = true
pdfView.usePageViewController(true, withViewOptions: nil)
pdfView.enableDataDetectors = false
pdfThumbnailView.thumbnailSize = CGSize(width: 44, height: 32)
pdfThumbnailView.pdfView = pdfView
pdfThumbnailView.layoutMode = .horizontal
去PDFOutline
// Load the first outline element
let outline = document.outlineRoot?.child(at: 0)?.child(at: 0)
let destination = outline!.destination
// This way to access the destination yields in the same thing
let destinationViaAction = (outline?.action as? PDFActionGoTo)?.destination
// Nothing happens here...
pdfView.go(to: destinationViaAction!)
// nor here
pdfView.go(to: destination!)
问题
- 那些现有的插入值没有正确计算属性
zoom
和point
的属性是 PDFKit 中的一个错误吗?PDFDestination
- 我可以解析
description
ofPDFDestination
并使用这些值吗?还是苹果会因为访问私人信息而拒绝我的应用程序?
更新
我在 Apple 提交了一个错误,并在收到回复时更新此问题。