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

how to get coordinates

More
IP: 192.168.0.71 8 years 6 months ago #12835 by Shades
Hello,

I am trying to get the coordinates of an image that I merged with a pdf,but I think there is something wrong :
Code:
struct PDFV_POS pos1; struct PDFV_POS pos2; [m_view vGetPos:&pos1 :imageViewFrame.origin.x /m_scale :imageViewFrame.origin.y /m_scale]; [m_view vGetPos:&pos2 :(imageViewFrame.origin.x + imageViewFrame.size.width) / m_scale :(imageViewFrame.origin.y + imageViewFrame.size.height) / m_scale]; PDF_RECT rect; rect.left = pos1.x; rect.right = pos2.x; rect.top = pos2.y; rect.bottom = pos1.y; newFrame = CGRectMake(rect.left , rect.top, rect.right, rect.bottom);

Can you please help me ?

Thank you
More
IP: 192.168.0.71 8 years 6 months ago #12838 by emanuele
Replied by emanuele on topic how to get coordinates
Hi,

you could try something like;
Code:
[m_view vGetPos:&pos1 :imageViewFrame.origin.x :imageViewFrame.origin.y + imageViewFrame.size.height]; [m_view vGetPos:&pos2 :imageViewFrame.origin.x + imageViewFrame.size.width :imageViewFrame.origin.y];
More
IP: 192.168.0.71 8 years 6 months ago #12839 by Shades
Replied by Shades on topic how to get coordinates
Thank you
But actually I get wrong values after doing this :
Code:
[m_view vGetPos:&pos1 :frame.origin.x/m_scale :(frame.origin.y + frame.size.height)/m_scale]; [m_view vGetPos:&pos2 :(frame.origin.x + frame.size.width)/m_scale :frame.origin.y/m_scale]; PDF_RECT rect; rect.left = pos1.x; rect.right = pos2.x; rect.top = pos2.y; rect.bottom = pos1.y;
More
IP: 192.168.0.71 8 years 6 months ago #12878 by emanuele
Replied by emanuele on topic how to get coordinates
Hi,

the following code uses also the m_scale to get the correct rect:
Code:
[m_view vGetPos:&pos1 :imageViewFrame.origin.x * m_scale :(imageViewFrame.origin.y + imageViewFrame.size.height) * m_scale]; [m_view vGetPos:&pos2 :(imageViewFrame.origin.x + imageViewFrame.size.width) * m_scale :imageViewFrame.origin.y * m_scale]; PDF_RECT rect; rect.left = pos1.x; rect.top = pos1.y; rect.right = pos2.x; rect.bottom = pos2.y;

Pay attention to use correct coordinates to create your PDF_RECT
More
IP: 192.168.0.71 8 years 5 months ago #12917 by Shades
Replied by Shades on topic how to get coordinates
Hi
While following the code you had transmitted to me, I have always faced wrong positions:
When I do :
Code:
CGRect newFrame = CGRectMake(rect.left , rect.top, rect.right, rect.bottom);
This gives back a “y” at the top of the page while it should be at the bottom of the page..
can you please clarify it to me further ?

Thank you
  • Visitor
  • Visitor
IP: 192.168.0.71 8 years 5 months ago #12918 by
Replied by on topic how to get coordinates
Hi
While following the code you had transmitted to me, I have always faced wrong positions:
When I do :
Code:
CGRect newFrame = CGRectMake(rect.left , rect.top, rect.right, rect.bottom);
This gives back a “y” at the top of the page while it should be at the bottom of the page..
can you please clarify it to me further ?

Thank you
Time to create page: 0.436 seconds
Powered by Kunena Forum