如何在 Android 应用程序中打开 PDF 并允许用户使用嵌入的超链接? [英] How can I open a PDF in an Android app and allow the users to use the embedded hyperlinks?

查看:52
本文介绍了如何在 Android 应用程序中打开 PDF 并允许用户使用嵌入的超链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个 Android 应用程序,它将下载和缓存 PDF 文件(这些文件用于杂志的问题,而 PDF 文件格式是客户的要求).这些 PDF 文件将具有链接到 PDF 中其他位置以及广告商网站的超链接,因此超链接的工作非常重要.在研究这个问题时,似乎有两种方法可以实现向用户呈现 PDF:

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. 要求用户拥有 PDF 查看应用、创建 Intent 并在第 3 方应用中启动 PDF.
  2. 使用 PDF 呈现 API 在应用中本地显示 PDF.

对于第一种方法,我还没有找到实现超链接的免费 PDF 查看应用程序.Adobe 的 Reader 和其他(vuDroid、android PDF 查看器、droidreader,甚至 Google Docs)仅呈现 PDF,但不使链接可点击.有些应用程序似乎具有超链接支持(ezPDF、repligo、QuickOffice 和 Documents to Go),但它们不是免费的,但我的应用程序不能依赖于用户付费购买另一个应用程序来显示 PDF.是否有任何免费的 PDF 查看应用程序支持我忽略的超链接?

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?

对于第二种方法,我看到了一些 API 的建议,这些 API 都没有详细记录,也没有开箱即用的示例/教程来帮助开发人员了解如何使用它们.我查看了 muPDF、Android 的 itext 端口、PDFbox 和 android PDF 查看器源代码.有谁知道这些 API 之一(或我没有提到的)的一个很好的简单示例?

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)?

这些程序中的任何一个都可以正常工作,我只是在两条路径上都被卡住了.我已经阅读了在构建应用程序以本地呈现它时难以使用的 PDF 格式,因此我了解是否没有任何免费的东西可以满足我的需求.感谢您的帮助!

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!

推荐答案

终于找到了一个免费的支持超链接的 PDF 查看器!Qoppa Viewer 是一款支持超链接的免费 PDF 查看应用.他们还有 一个 SDK(不是免费的),可以帮助构建此功能进入一个应用程序.只是想为将来发现此问题的其他人更新此内容.

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.

这篇关于如何在 Android 应用程序中打开 PDF 并允许用户使用嵌入的超链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆