PDFKit bug with PDFPage.selectionForLineAtPoint()

Hello,


There is a bug with selectionForLineAtPoint, that I can reproduce on demand.


1) Non-working test

// pdf is a non-nil PDFDocument

let firstPage1 = pdf.pageAtIndex(0)

// print("page content = \(firstPage1.string())")

let testSel = firstPage1.selectionForLineAtPoint(NSPoint(x: 104.02734375,y: 500.90625))

print("test selection = \(testSel)")


=> displays test selection = nil in the console


2) Working test

Now uncomment third line:

// pdf is a non-nil PDFDocument

let firstPage1 = pdf.pageAtIndex(0)

print("page content = \(firstPage1.string())")

let testSel = firstPage1.selectionForLineAtPoint(NSPoint(x: 104.02734375,y: 500.90625))

print("test selection = \(testSel)")


=> displays the page content

=> displays test selection = "content of the pdf at the given point"

It works !


So why do I need to call some method on the page first for selectionForLineAtPoint to work ???