- Posts: 7
- Thank you received: 0
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
Open PDF on a specified section
IP: 194.28.116.213
6 years 4 months ago #14998
by robaba
Open PDF on a specified section was created by robaba
Hi,
from your Android sdk i know how to open a pdf on a specified page i.e. by suppling in the Android 's intent a page.
Is there another way to open a pdf on a certain "section"? For example by setting a TOC's element? How can i achieve that?
from your Android sdk i know how to open a pdf on a specified page i.e. by suppling in the Android 's intent a page.
Is there another way to open a pdf on a certain "section"? For example by setting a TOC's element? How can i achieve that?
IP: 93.36.222.154
6 years 4 months ago #15000
by nermeen
Replied by nermeen on topic Open PDF on a specified section
The demo project expects only a page index.
You can implement this by for example, saving the page index that corresponds to the TOC element somewhere and pass that to the intent. Or you can after openning the document scan the TOC and search for that TOC element and get the page to navigate to.
You can implement this by for example, saving the page index that corresponds to the TOC element somewhere and pass that to the intent. Or you can after openning the document scan the TOC and search for that TOC element and get the page to navigate to.
IP: 194.28.116.213
6 years 4 months ago #15001
by robaba
Replied by robaba on topic Open PDF on a specified section
By reading the docs section and the knowledge base i can't find an example of that.
Can you provide a sample of "scan the TOC and search for that TOC element and get the page to navigate to", please?
Can you provide a sample of "scan the TOC and search for that TOC element and get the page to navigate to", please?
IP: 93.36.222.154
6 years 4 months ago #15004
by nermeen
Replied by nermeen on topic Open PDF on a specified section
Something like:
And call it like:
Code:
private void scanOutlines(Document.Outline parent) {
for (Document.Outline root = parent; root != null; root = root.GetNext()) {
//some check here
if(root.GetTitle().equals("xxx")) {
m_view.PDFGotoPage(root.GetDest());
break;
}
if(root.GetChild() != null)
scanOutlines(root.GetChild());
}
}
And call it like:
Code:
if(m_doc.GetOutlines() != null)
scanOutlines(m_doc.GetOutlines());
Time to create page: 0.450 seconds