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

TOPIC:

Get StartIndex and EndIndex of highlighted text 6 years 2 months ago #13433

  • joshnaAppcare
  • joshnaAppcare's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
  • Thank you received: 0
Hi,
Thanks for your reply
what will be the implementation of methods - (int)getStartIndex; and - (int)getEndIndex; in PDFVSel

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

Get StartIndex and EndIndex of highlighted text 6 years 2 months ago #13439

  • federico
  • federico's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 261
  • Thank you received: 18
Hi,
Regarding the methods getStartIndex and getEndIndex the implementation is what i said in the previous post.

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

Get StartIndex and EndIndex of highlighted text 6 years 2 months ago #13441

  • joshnaAppcare
  • joshnaAppcare's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
  • Thank you received: 0
Hi,

yes but you told to implement in PDFVPage as below
If you want to get indexes you can add in PDFVPage class two methods:
- (int)GetSelStartIndex
{
return [m_sel getStartIndex];
}

- (int)GetSelEndIndex
{
return [m_sel getEndIndex];
}

but what should be the implementation in PDFVSel

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

Get StartIndex and EndIndex of highlighted text 6 years 2 months ago #13446

  • federico
  • federico's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 261
  • Thank you received: 18
Hi,
In PDFVPage class, you could add in PDFVSel implementation getStartIndex and getEndIndex methods:
- (int)getStartIndex
{
    return m_index1;
}
- (int)getEndIndex
{
    return m_index2;
}

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

Get StartIndex and EndIndex of highlighted text 6 years 1 week ago #13719

  • joshnaAppcare
  • joshnaAppcare's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
  • Thank you received: 0
Hi,
But i am using pdfPage not using PDFVPage so how can i use these methods?

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

Get StartIndex and EndIndex of highlighted text 6 years 1 week ago #13727

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,
if you correctly implemented the code in previous posts, you will be able to get start and end index of the selection in OnSelTouchEnd method (PDFView class).
The current implementation get the selection's rect with [vpage GetSelRect], but you can use getStartIndex and getEndtIndex (explained in previous posts) to get indexes.
To get the PDFVPage instance of the selected text, you can use [m_view vGetPage:m_cur_page] as OnSelTouchEnd method already does.
If it could help. you can also edit the OnSelEnd delegate method and add start and end index of the selection, to retrieve these informations in RDPDFViewController.
You can add this code in OnSelTouchEnd implementation:
int start = [vpage GetSelStartIndex];
int end = [vpage GetSelEndIndex];
then edit OnSelEnd in this way:
- (void)OnSelEnd:(float)x1 :(float)y1 :(float)x2 :(float)y2 :(int)start :(int)end;

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

Powered by Kunena Forum