Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1
  • 2

TOPIC:

how to get coordinates 6 years 7 months ago #12835

  • Shades
  • Shades's Avatar Topic Author
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 37
  • Thank you received: 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

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

how to get coordinates 6 years 7 months ago #12838

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
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];

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

how to get coordinates 6 years 7 months ago #12839

  • Shades
  • Shades's Avatar Topic Author
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 37
  • Thank you received: 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;

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

how to get coordinates 6 years 7 months ago #12878

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
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

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

how to get coordinates 6 years 6 months ago #12917

  • Shades
  • Shades's Avatar Topic Author
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 37
  • Thank you received: 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

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

how to get coordinates 6 years 6 months ago #12918

  • 's Avatar
  • Visitor
  • Visitor
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

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

  • Page:
  • 1
  • 2
Powered by Kunena Forum