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

Conversion coordintes

More
IP: 192.168.0.71 9 years 1 week ago #12836 by ichrak22
Hello,
How can I calculte the right position of an Object within PDF through PDF_RECT ?
What is the error in the code snippet below?
Code:
struct PDFV_POS pos1; PDF_RECT rect; [m_view vGetPos:&pos1 :frame.origin.x * m_scale :frame.origin.y * m_scale]; rect.left = pos1.x; rect.top = pos1.y; int dx; int dy; [m_view vGetDeltaToCenterPage:pos1.pageno :&dx :&dy]; y =(rect.top +self.contentOffset.y + dy)/m_scale; x =(rect.left+self.contentOffset.x + dx)/m_scale ;
Thank you
More
IP: 192.168.0.71 9 years 1 week ago #12837 by emanuele
Replied by emanuele on topic Conversion coordintes
Hi,

you can take a look at onSingleTap method of PDFView class, where it get the rect of a selected annotation and convert it to screen size in this way:
Code:
[m_annot getRect:&m_annot_rect]; m_annot_rect.left = [vpage GetX] - self.contentOffset.x * m_scale + [vpage ToDIBX:m_annot_rect.left]; m_annot_rect.right = [vpage GetX] - self.contentOffset.x * m_scale + [vpage ToDIBX:m_annot_rect.right]; float tmp = m_annot_rect.top; m_annot_rect.top = [vpage GetY] - self.contentOffset.y * m_scale + [vpage ToDIBY:m_annot_rect.bottom]; m_annot_rect.bottom = [vpage GetY] - self.contentOffset.y * m_scale + [vpage ToDIBY:tmp];

Then you can get the CGRect with something like:
Code:
CGRectMake(m_annot_rect.left, m_annot_rect.top, m_annot_rect.right - m_annot_rect.left, m_annot_rect.bottom - m_annot_rect.top)
Time to create page: 0.398 seconds
Powered by Kunena Forum