Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android中在视图上呈现pdf的最佳方法_Android_Pdf_Android Droidtext - Fatal编程技术网

在android中在视图上呈现pdf的最佳方法

在android中在视图上呈现pdf的最佳方法,android,pdf,android-droidtext,Android,Pdf,Android Droidtext,我知道有很多可用的库不适合商业用途,比如mupdf。我的公司是一家初创公司,没有能力花很多钱。我正在开发一个杂志应用程序。有人能推荐一个好的开源库来呈现单个pdf吗?如果不可能,我应该选择付费库中的哪一个?提前感谢您可以将webview与谷歌文档一起使用 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"

我知道有很多可用的库不适合商业用途,比如mupdf。我的公司是一家初创公司,没有能力花很多钱。我正在开发一个杂志应用程序。有人能推荐一个好的开源库来呈现单个pdf吗?如果不可能,我应该选择付费库中的哪一个?提前感谢

您可以将webview与谷歌文档一起使用

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<WebView
android:id="@+id/wv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/> 
您可以使用intent。您的手机必须具有pdf阅读器应用程序

  File file = new File("/sdcard/example.pdf");
            if (file.exists()) {
                Uri path = Uri.fromFile(file);
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setDataAndType(path, "application/pdf");
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                try {
                    startActivity(intent);
                } 
                catch (ActivityNotFoundException e) {
                    Toast.makeText(OpenPdf.this, 
                        "No Application Available to View PDF", 
                        Toast.LENGTH_SHORT).show();
                }
。PDF查看器


。APDF查看器。

我没有看到任何好的免费的。我见过的三个收入不错或更高的是雷德、库帕和普夫特隆。从最差到最好,从最便宜到最贵,这几乎是最差到最好的顺序。Qoppa是我使用过的,它在价格和性能上都达到了最佳水平。谢谢你的评论。让我试试。我想在我的应用程序中嵌入pdf阅读器,我希望它在阅读下载并保存在内存中的pdf时速度相当快。所以我认为这不是一个好主意。
  File file = new File("/sdcard/example.pdf");
            if (file.exists()) {
                Uri path = Uri.fromFile(file);
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setDataAndType(path, "application/pdf");
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                try {
                    startActivity(intent);
                } 
                catch (ActivityNotFoundException e) {
                    Toast.makeText(OpenPdf.this, 
                        "No Application Available to View PDF", 
                        Toast.LENGTH_SHORT).show();
                }