开发者

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

开发者 https://www.devze.com 2023-02-24 22:35 出处:网络
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 t

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 looke开发者_如何学编程d 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!


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.


Finally found a free PDF viewer that supports hyperlinks! Qoppa Viewer is a free PDF viewing app that supports hyperlinks. They also have an SDK (not free) that could be helpful in building this functionality into an app. Just wanted to update this for other people that find this question in the future.


I had the same problem, after hacking my way through MuPDF for a month and not getting any features I want, including hyperlinks, highlights and annotations. I checked for using 3rd party free apps.

Conclusion: I do not have time and money to create or improve a library to my wishes, and I haven't found any 3rd party free apps.

I use Repligo reader now because it fits all my wishes and it works like a charm.

Maybe next year :)


Did you try ThinkFree? I have it on my Android and it says it supports hyperlinks. Try it out.

0

精彩评论

暂无评论...
验证码 换一张
取 消