Why can not remove selected text correctly? - RadaeePDF.com
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 Android development and PDF
  • Page:
  • 1

TOPIC: Why can not remove selected text correctly?

Why can not remove selected text correctly? 4 years 4 months ago #6510

  • discoby
  • discoby's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
We implement a function that some new texts will be selected and old ones will be released when user tapped. The question is not all old ones will be released correctly.
After doing PDFView.vRenderSync(...) some old selected texts are still selected (marked on screen).

Here is the code sample:
PDFView m_view;
Document m_doc;


void functionXXX(){
...

// release old selected texts first if they exist...
Page anntPage = m_doc.GetPage(m_pageno);
int AnnotCount = anntPage.GetAnnotCount();
if (AnnotCount > 0){
for (int z = 0 ; z < AnnotCount ; z++){
Annotation a = anntPage.GetAnnot(z); //
if (a != null) a.RemoveFromPage(); // <<< Problem: some times we will get null????
}
}
anntPage.Close();

PDFVPage vpage = m_view.vGetPage(m_pageno);
Page page_cur = vpage.GetPage();
...
for (...){
...// check char index is what we want...
page_cur.AddAnnotMarkup(hit_srart, hit_end, 9); // mark the texts we selected...
}
...
m_view.vRenderSync(vpage); // re-render the page...

} // End of function


Did i miss something?

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

Why can not remove selected text correctly? 4 years 4 months ago #6511

  • discoby
  • discoby's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
Example:

// These texts on the screen are marked...
QQQQQQ
AAAAAA
ZZZZZZ
WWWWWW



// We tapped some new texts...
QQQQQQ <- should be released but still marked on the screen
ZZZZZZ <- should be released but still marked on the screen


DDDDDD <- new text marked on the screen

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

Last edit: by freeed.

Why can not remove selected text correctly? 4 years 4 months ago #6512

  • nermeen
  • nermeen's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 865
  • Karma: 23
  • Thank you received: 70
You need to implement the loop differently, as doing it like this,
for (int z = 0 ; z < AnnotCount ; z++){
Annotation a = anntPage.GetAnnot(z);	//
if (a != null) a.RemoveFromPage();	// <<< Problem: some times we will get null????
}

wont work correctly, as after removing an annotation the annotation count is different and the annotation indices will be different

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

Why can not remove selected text correctly? 4 years 4 months ago #6513

  • discoby
  • discoby's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
Thanks for your reply!!!!

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

  • Page:
  • 1
Powered by Kunena Forum