Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须提供在我的应用程序中显示 PDF 文档的功能,而无需使用任何外部 PDF 查看器。我知道 Android 没有这种小部件,WebView 无法加载 PDF 文档。
所以我想知道,是否有任何可用的小部件可用于在 Activity 中显示 PDF 文档(如 WebView 用于显示网页)?
据我所知,目前还没有适用于 Android 的“现成”解决方案。您当然可以下载任何第三方 PDF 查看器的代码并根据您的需要进行修改。一些开源 PDF 查看器:
这已经在https://stackoverflow.com/questions/4665957/pdf-parsing-library-for-android
另一种解决方案是使用 WebView,然后使用 pdf.js 库来显示给定的 pdf 文件。我怀疑这在小型移动设备上看起来会很好,因为它是为桌面浏览器设计的,但值得一试。
pdf.js 网站和演示