Mario
Mario

Reputation: 55

Android and PDFs: Opening document by a certain page?

I've been working on some apps opening PDFs from directories, no problem at all. My next step (and question, therefore) is, can you open a PDF and, having some sort of variable, do it by a certain page? Something like programmatically bookmarking certain pages and, by clicking on those bookmarks from my view, open the PDF viewer by those pages (i.e., "open xxxx.pdf on page 66").

Tried to use http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf, specifically adding #page=66 to the filename, but doesn't work...

EDITED: Adobe Reader does not supporrt this feature as of Feb. 2012 on its 10.1 Version. Is there any other PDF reader with this feature?

Upvotes: 2

Views: 1227

Answers (1)

siwest
siwest

Reputation: 66

I have the same problem and I found this answer:

You can save settings to a PDF using iText library:

PdfDestination dest = new PdfDestination(PdfDestination.FIT);
PdfAction action =
     PdfAction.gotoLocalPage(
             2,               // the page number
             dest,         // the destination on the page
             writer);    // the writer object
writer.setOpenAction(action);

Alternatively, you may be to use iText to set PDF open parameters, but I have not tried this.

Note that you have to pay to use iText for Android.

Upvotes: 4

Related Questions