Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about iOS development and PDF

Сonversion of coordinates

More
10 years 1 month ago #10301 by petiva
Hi.
I am implementing a custom selection of text.
I added subView in PDFView, so the user can control the selection.
First, I got the index of the character nearest to the coordinate subView. (from method
Code:
-(int)objsGetCharIndex:(float)x :(float)y;
)
Then I received PDF_RECT coordinate (from method
Code:
objsCharRect:(int)index :(PDF_RECT *)rect;
)
I wanna convert this into PDFView coordinate for UIScrollView. How can I achieve this?
More
10 years 1 month ago - 10 years 1 month ago #10312 by emanuele
Replied by emanuele on topic Сonversion of coordinates
Hi,

to get coordinates from a PDF_RECT you should get rect.left and rect.top as x and y, then apply the current scale with something like:

viewX = rect.left / m_scale;
viewY = rect.top / m_scale;
Last edit: 10 years 1 month ago by emanuele.
Time to create page: 0.419 seconds
Powered by Kunena Forum