how to get startIndex and endIndex of highlighted text in PDF - Page 2 - RadaeePDF.com - Results from #6
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about iOS development and PDF

TOPIC: how to get startIndex and endIndex of highlighted text in PDF

Get StartIndex and EndIndex of highlighted text 7 months 2 weeks ago #13433

  • joshnaAppcare
  • joshnaAppcare's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • 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 7 months 2 weeks ago #13439

  • federico
  • federico's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 50
  • Thank you received: 4
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 7 months 2 weeks ago #13441

  • joshnaAppcare
  • joshnaAppcare's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • 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 7 months 2 weeks ago #13446

  • federico
  • federico's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 50
  • Thank you received: 4
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 5 months 1 week ago #13719

  • joshnaAppcare
  • joshnaAppcare's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • 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 5 months 1 week ago #13727

  • emanuele
  • emanuele's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 509
  • Karma: 15
  • Thank you received: 56
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