简体   繁体   English

在外部应用程序中打开pdf

[英]Open pdf in external app

I have and android app. 我有和Android应用程序。 It has a pdf in assets folder. 它在资产文件夹中有一个pdf。 I written a code to view this pdf in external app(like adobe pdf viewer). 我写了一个代码来在外部应用程序中查看这个pdf(比如adobe pdf viewer)。 It is working fine but problem is that there is Share option in Adobe pdf viewer. 它工作正常,但问题是Adobe pdf viewer中有Share选项。 I dont want that user can distribute this pdf. 我不希望该用户可以分发此pdf。

My problem is that there is an important pdf book and I want user can read only but can not share or redistribute it. 我的问题是有一本重要的pdf书,我希望用户只能阅读,但不能共享或重新分发。 Please give an idea. 请提出一个主意。 I will change my code. 我会改变我的代码。

I am using following code: 我使用以下代码:

Uri path = Uri.fromFile(new File(str,
                "lemmelibroandroid.pdf")); 
Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
pdfIntent.setDataAndType(path, "application/pdf");
pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(pdfIntent);

I dont think it is possible to limit the capabilities of the external application used to open the pdf 我不认为可以限制用于打开pdf的外部应用程序的功能

Have a look at http://asmncl.blogspot.in/2012/06/android-open-pdf-file-in-webview.html to see how to open the pdf in a WebView 查看http://asmncl.blogspot.in/2012/06/android-open-pdf-file-in-webview.html ,了解如何在WebView中打开pdf

It is not possible,so the best option here will be to show your content in your own app. 这是不可能的,因此这里最好的选择是在您自己的应用中显示您的内容。
I am sure that you will find a proper way to display it some how in activity. 我相信你会找到一种正确的方式来展示它的活动方式。
Maybe you should change the format of PDF to HTML and it will be easier to show. 也许您应该将PDF的格式更改为HTML,并且更容易显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM