【问题标题】:How to Open PDF file from First page in android如何从android的第一页打开PDF文件
【发布时间】:2013-09-12 07:41:50
【问题描述】:

我想在 android 中显示第一页的 PDF 文件

现在我使用下面的代码显示 PDF 文件。重新打开 pdf 后它显示当前页面而不是重定向第一页。

如何在android中重定向PDF的第一页?

Intent intent  = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);                                

【问题讨论】:

    标签: java javascript android pdf


    【解决方案1】:

    试试这个代码,

    final Intent intent = new Intent(First.this, Second.class);
          intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, path);
          startActivity(intent);
    

    从此链接下载 pdfviewer.jar 文件。

    http://www.ziddu.com/download/19248664/PdfViewer.jar.html

    【讨论】:

      【解决方案2】:

      我不是 android 专家,但您尝试过使用 android:noHistory="true" 吗?您可以在清单文件中进行设置。据我了解,它会阻止您的应用程序恢复。

      文档:

      android:noHistory

      当用户离开它并且它在屏幕上不再可见时,是否应该从 Activity 堆栈中删除并完成(调用它的 finish() 方法) - 如果应该完成,则为“true”,并且如果不是,则为“假”。默认值为“false”。

      值为“true”表示该活动不会留下历史痕迹。它不会保留在任务的活动堆栈中,因此用户将无法返回到它。

      参考:http://developer.android.com/guide/topics/manifest/activity-element.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-03-22
        • 2011-12-24
        • 2011-04-04
        • 2013-07-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多