【发布时间】:2013-03-09 09:08:28
【问题描述】:
我正在开发一个 pdf 阅读器,因为 android 没有任何原生 pdf 查看器,所以我必须使用第三方 pdf 查看器。 在这种情况下,我选择了适用于 android 的 Adobe pdf 查看器。 我可以打开存储在设备 SD 卡中的 pdf 文件。 现在我想从我的应用程序中打开受密码保护的 pdf 文件。 如果用户想手动打开受密码保护的 pdf 文件,请使用 打开时必须提供密码。 但我想从我的应用程序中打开那些密码 pdf 文件 任何密码提示。 应用程序提供密码,[应用程序知道密码]和没有 任何密码提示,pdf都会打开。
目前,如果我想从我的 应用程序然后出现密码提示,需要密码才能 打开它。
我正在使用此代码从 SDCARD 中存储的 pdf 文件中打开 pdf。
====
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文件,而无需 提示任何密码窗口。 ?
【问题讨论】: