Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open a PDF in an Android app and allow the users to use the embedded hyperlinks?

Tags:

android

pdf

api

I am creating an Android app that will download and cache PDF files (the files are for issues of a magazine and the PDF file format is the client's requirement). These PDF files will have hyperlinks that link to other locations in the PDF as well as advertisers' websites, so it is important that the hyperlinks work. In researching this problem, there seem to be two ways to implement presenting a PDF to a user:

  1. Require the user to have a PDF viewing app, create an Intent and launch the PDF in the 3rd party app.
  2. Use a PDF rendering API to display the PDF natively in the app.

For the first method, I have yet to find a free PDF viewing app that implements hyperlinks. Adobe's Reader and others (vuDroid, android PDF viewer, droidreader, even Google Docs) only render the PDF but do not make the links clickable. There are apps that seem to have hyperlink support (ezPDF, repligo, QuickOffice and Documents to Go) that are not free, but my app can not depend on the user paying for another app to display the PDF. Are there any free PDF viewing apps that support hyperlinks that I've overlooked?

For the second method, I've seen recommendations for a few APIs, none of which are well-documented or have examples/tutorials that work out of the box to help developers understand how to use them. I've looked at muPDF, the itext port to Android, PDFbox and the android PDF viewer source code. Does anyone know of a good, simple example of one of these APIs (or one I didn't mention)?

Either one of these procedures would work fine, I've just gotten stuck going down both paths. I've read the PDF format is difficult to work with when building an app to render it natively, so I understand if there is nothing free out there that meets my needs. Thanks for the help!

like image 308
Eric Brynsvold Avatar asked Apr 14 '11 03:04

Eric Brynsvold


1 Answers

Update as of May 2013. Install Adobe Reader for free on an Android phone. When opening a pdf document with hyperlinks, choose to open with Adobe Reader and you should have no trouble accessing the links.

Update May 15, 2016- I opened it in Adobe Reader and it still didn't work. It is a link to a google maps address if that helps.

like image 148
Dee Avatar answered Nov 06 '22 14:11

Dee