【问题标题】:Best method to render a pdf on a view in android在android中的视图上呈现pdf的最佳方法
【发布时间】:2013-03-21 06:27:57
【问题描述】:

我知道有很多图书馆不适合像 mupdf 这样的商业用途。我的公司是一家初创公司,没有能力花很多钱。我正在开发一个杂志应用程序。任何人都可以建议一个好的开放- 用于呈现单个 pdf 的源库,或者如果不可能的话,我应该更喜欢付费的哪一个?在此先感谢

【问题讨论】:

  • 我还没有看到任何好的免费的。我见过的 3 个体面或报酬更高的是 Raede、Qoppa 和 PdfTron。这几乎是最差的订单,最便宜的最贵。我使用的是 Qoppa,它达到了价格和性能的最佳平衡点。
  • 感谢您的评论。让我试一试。

标签: android pdf android-droidtext


【解决方案1】:

您可以将 webview 与 google 文档一起使用。

<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"/> 

 WebView wv= (WebView) findViewById(R.id.wv);
 wv.setVerticalScrollBarEnabled(true);
 wv.setHorizontalScrollBarEnabled(true);
 wv.getSettings().setBuiltInZoomControls(true);
 wv.getSettings().setJavaScriptEnabled(true);
 wv.setWebViewClient(new WebViewClient());
 wv.loadUrl("https://docs.google.com/file/d/0B8ZDVNCvRWK8c3YzQVFaWjg1bEU/edit")//pdf uploaded to google docs. Some cases requires users to login and requires permission of the owner of the doc.

您可以使用意图。您的手机必须有 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();
                }

http://code.google.com/p/apv/source/checkout。 APV PDF 查看器

http://code.google.com/p/apdfviewer/。 APDF 查看器。

【讨论】:

  • 我想在我的应用程序中嵌入 pdf 阅读器,我希望它在阅读下载并保存在内存中的 pdf 时会非常快。所以我认为这不是一个好主意。
猜你喜欢
  • 1970-01-01
  • 2011-11-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-03
  • 1970-01-01
  • 2013-05-08
相关资源
最近更新 更多