在Android的查看器中打开受密码保护的PDF文件 [英] Open Password Protected PDF file within a viewer in android

查看:562
本文介绍了在Android的查看器中打开受密码保护的PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发pdf阅读器,因为android没有任何本机pdf 查看器,所以我必须使用第三方pdf查看器. 在这种情况下,我选择了适用于Android的Adobe pdf查看器. 我可以打开存储在设备sdcard中的pdf文件. 现在,我想从我的应用程序中打开受密码保护的pdf文件. 如果用户想手动打开受密码保护的pdf文件,请使用 打开时必须提供密码. 但我想从我的应用程序中打开那些密码pdf文件,而无需 任何密码提示. 应用提供密码,[应用知道密码] 任何密码提示,pdf都会打开.

I am developing a pdf reader, as android don't have any native pdf viewer so i have to use third party pdf viewer. in that case i have chose the Adobe pdf viewer for android. I can open pdf file which are stored in sdcard of my device. Now i want to open password protected pdf file from my application. If user wants to open password protected pdf file manually then use have to provide password while opening. but i want to open those password pdf file from my application without any password prompt. Application provide the password,[apps knows the password] and without any password prompt, pdf will open.

当前,如果我想从我的手中打开任何受密码保护的pdf文件 应用程序,然后出现密码提示,并且需要密码才能 打开它.

currently if i want to open any password protected pdf file from my application then a password prompt is appeared and needs a password to open it.

我正在使用此代码从SDCARD中存储的pdf文件中打开pdf.

I am using this code to open pdf from my stored pdf files in the SDCARD.

====

File pdfFile = new File(fileLocation); 
if (pdfFile.exists()) 
{ 
    Uri pdfFilepathUri = Uri.fromFile(pdfFile); 
    Intent intent = new Intent(Intent.ACTION_VIEW);    

    intent.setDataAndType(pdfFilepathUri, "application/pdf");      
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
    try 
    { 
        startActivity(intent);
    } 
    catch (ActivityNotFoundException e) 
    { 
        Toast.makeText(this,"No Application Available to View PDF : "+fileLocation,Toast.LENGTH_LONG).show(); 
    } 
} 
 else 
Toast.makeText(this,"File cannot found : "+fileLocation,Toast.LENGTH_SHORT).show(); 

====

任何人都可以帮助我如何从 应用程序,以便它可以自动打开pdf文件,而无需 提示输入任何密码窗口. ?

can anybody please help how can i provide the password from the application, so that it can open pdf file automatically without prompting any password window. ?

推荐答案

如果用户要手动打开受密码保护的pdf文件,则在打开时必须提供密码.但是我想从我的应用程序中打开那些密码pdf文件,而没有任何密码提示.

If user wants to open password protected pdf file manually then use have to provide password while opening. but i want to open those password pdf file from my application without any password prompt.

欢迎您与各种PDF查看应用程序的作者联系,以查看他们是否支持通过Intent Extra或其他方式传递PDF密码.记录在案的ACTION_VIEW协议中肯定没有支持这种情况的

You are welcome to contact the authors of various PDF viewing apps to see if they support passing of a PDF password via an Intent extra or something. There certainly is nothing in the documented ACTION_VIEW protocol that is designed to support this scenario.

这篇关于在Android的查看器中打开受密码保护的PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆