Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Initializing the fields when pdf loads up

More
9 years 11 months ago - 9 years 11 months ago #10537 by sharikakanakam
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?
Last edit: 9 years 11 months ago by sharikakanakam.
More
9 years 11 months ago #10538 by Davide
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:
Code:
new Handler().postDelayed(new Runnable() { @Override public void run() { //your code } }, 500);
Time to create page: 0.398 seconds
Powered by Kunena Forum