Сonversion of coordinates - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC: Сonversion of coordinates

Сonversion of coordinates 3 years 1 month ago #10301

  • petiva
  • petiva's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 0
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
-(int)objsGetCharIndex:(float)x :(float)y;
)
Then I received PDF_RECT coordinate (from method
objsCharRect:(int)index :(PDF_RECT *)rect;
)
I wanna convert this into PDFView coordinate for UIScrollView. How can I achieve this?

Please Log in or Create an account to join the conversation.

Сonversion of coordinates 3 years 1 month ago #10312

  • emanuele
  • emanuele's Avatar
  • Online
  • Moderator
  • Moderator
  • Posts: 543
  • Karma: 21
  • Thank you received: 65
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;

Please Log in or Create an account to join the conversation.

Last edit: by emanuele.
  • Page:
  • 1
Powered by Kunena Forum