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 months 1 week ago #12835

  • Shades
  • Shades's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 36
  • 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 months 6 days ago #12838

  • emanuele
  • emanuele's Avatar
  • OFFLINE
  • Moderator
  • Posts: 440
  • Thank you received: 50
  • 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 2 months 5 days ago #12839

  • Shades
  • Shades's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 36
  • 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 1 month 4 weeks ago #12878

  • emanuele
  • emanuele's Avatar
  • OFFLINE
  • Moderator
  • Posts: 440
  • Thank you received: 50
  • 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.

how to get coordinates 1 month 2 weeks ago #12917

  • Shades
  • Shades's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 36
  • Karma: 0
Hi
While following the code you had transmitted to me, I have always faced wrong positions:
When I do :
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
The administrator has disabled public write access.

how to get coordinates 1 month 2 weeks ago #12918

  • 's Avatar
Hi
While following the code you had transmitted to me, I have always faced wrong positions:
When I do :
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
The administrator has disabled public write access.
Powered by Kunena Forum