RadaeePDF.com :: Topic: how to get coordinates (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about iOS development and PDF

TOPIC: how to get coordinates

how to get coordinates 2 weeks 4 days ago #12835

  • Shades
  • Shades's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 37
  • Karma: 0
Hello,

I am trying to get the coordinates of an image that I merged with a pdf,but I think there is something wrong :
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
The administrator has disabled public write access.

how to get coordinates 2 weeks 13 hours ago #12838

  • emanuele
  • emanuele's Avatar
  • OFFLINE
  • Moderator
  • Posts: 428
  • Thank you received: 46
  • Karma: 14
Hi,

you could try something like;
[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];
The administrator has disabled public write access.

how to get coordinates 1 week 6 days ago #12839

  • Shades
  • Shades's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 37
  • Karma: 0
Thank you
But actually I get wrong values after doing this :
    [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;
The administrator has disabled public write access.

how to get coordinates 6 days 14 hours ago #12878

  • emanuele
  • emanuele's Avatar
  • OFFLINE
  • Moderator
  • Posts: 428
  • Thank you received: 46
  • Karma: 14
Hi,

the following code uses also the m_scale to get the correct rect:
    [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
The administrator has disabled public write access.
Powered by Kunena Forum