KurtCode / PDFKitten

A framework for extracting data from PDFs in iOS
MIT License
391 stars 113 forks source link

How to highlight in right positions when pdf page is resized and centered? #54

Open ThanhBHKloon opened 11 years ago

ThanhBHKloon commented 11 years ago

Hi, I do not draw the pdf page as-is, but I resize and center it so that it fits the screen. How can I re-calculate the position to display the highlights (the yellow areas)?

Basically, if I have an outer frame, an inner frame which lies on the outer, then when I change the outer frame, I can calculate the inner frame to fit in the new outer frame. But your selection.frame seems not to be be what I can use to calculate. (selection.frame depends on the graphic context...) I guess that when I read the code: for (Selection *s in self.selections) { CGContextSaveGState(ctx); CGContextConcatCTM(ctx, s.transform); CGContextFillRect(ctx, s.frame); CGContextRestoreGState(ctx); }