RadaeePDF.com :: Topic: Why can not remove selected text correctly? (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: Why can not remove selected text correctly?

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

  • discoby
  • discoby's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 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?
The administrator has disabled public write access.

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

  • discoby
  • discoby's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 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
Last Edit: 3 years 2 months ago by freeed.
The administrator has disabled public write access.

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

  • nermeen
  • nermeen's Avatar
  • OFFLINE
  • Moderator
  • Posts: 683
  • Thank you received: 40
  • Karma: 18
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
The administrator has disabled public write access.

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

  • discoby
  • discoby's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0
Thanks for your reply!!!!
The administrator has disabled public write access.
Powered by Kunena Forum