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

TOPIC:

Initializing the fields when pdf loads up 9 years 2 weeks ago #10537

  • sharikakanakam
  • sharikakanakam's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 0
Im trying to initialize my pdf with some field values when the pdf loads up. Im looping through the annots using the below code :

for(int pageno = 0; pageno < m_doc.GetPageCount(); pageno++) {
page = m_doc.GetPage(pageno);
Log.e("annot count", "annot count" + page.GetAnnotCount());
// my code goes here to initialize each field.
for (int index = 0; index < page.GetAnnotCount(); index++) {
annot = page.GetAnnot(index);
}
}

But the page.GetAnnotCount is 0. What could be the reason for this? Im calling this only after setting the m_layout. And I've made sure the pdf is fully loaded before calling page.GetAnnotCount(). Please can you take a look?

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

Last edit: by sharikakanakam.

Initializing the fields when pdf loads up 9 years 2 weeks ago #10538

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
I think you are calling the GetAnnotCount() before the pdf is ready to get all the annot.
So I suggest you to start your operations after a delay, something like that:
new Handler().postDelayed(new Runnable() {
	@Override
	public void run() {
		//your code
	}
}, 500);

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

  • Page:
  • 1
Powered by Kunena Forum