PDFDestination is not giving me the right information (Apple PDFKit)

503 Views Asked by At

I've got a PDF file of a technical drawing that contains one page with bookmarks linking to specific areas of the document.

When I click those bookmarks in Adobe Reader or Foxit Reader, it zooms to this specified area. But in Apple's Preview.app or iBooks or a PDFKit based iOS-App it won't work. Even PSPDFKit can't handle those bookmarks.

I'm building a PDFView based iOS-App that can handle those bookmarks. When I debug the PDFOutline property I can see that the contained PDFDestination object contains the information, but in private fields. I can watch them during debugging.

enter image description here

Also when I access the description property of the PDFDestination object, I'm getting the following:

FitR, page = 0, l = 132.0, b = 451.0, r = 400.0, t = 724.0

But the values zoom and point return 3.40282347e+38F which is the max value of CGFloat on 32-bit systems which means they're not properly set.


PDFView Config

Here's a litte more code, showing how I configured my 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

Go to 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!)

Questions

  1. Is it a bug in PDFKit that the properties zoom and point of PDFDestination are not correctly calculated by those existing inset values?
  2. Am I allowed to parse the description of PDFDestination and work with those values? Or will Apple refuse my App because of accessing private information?

Update

I filed a bug at Apple and will update this question when I get a response.

0

There are 0 best solutions below