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

TOPIC:

Open PDF on a specified section 3 years 11 months ago #14998

  • robaba
  • robaba's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
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?

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

Open PDF on a specified section 3 years 11 months ago #15000

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
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.

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

Open PDF on a specified section 3 years 11 months ago #15001

  • robaba
  • robaba's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
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?

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

Open PDF on a specified section 3 years 11 months ago #15004

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
Something like:
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:
if(m_doc.GetOutlines() != null)
        scanOutlines(m_doc.GetOutlines());
The following user(s) said Thank You: robaba

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

  • Page:
  • 1
Powered by Kunena Forum