我希望能够在我的 Android 中打开 pdf 文件并用英语或阿拉伯语搜索特定单词。如何在代码中执行此操作以及进行搜索的最佳 pdf 查看器是什么?
最佳答案
尝试打开 pdf 文件
File pdfFile = new File("path");
if(pdfFile.exists())
{
Uri path = Uri.fromFile(pdfFile);
Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
pdfIntent.setDataAndType(path, "application/pdf");
pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try
{
startActivity(pdfIntent);
}
catch(ActivityNotFoundException e)
{
Toast.makeText(MyPDFDemo.this, "No Application available to view pdf", Toast.LENGTH_LONG).show();
}
}
您可以根据您的要求从这个link找到PDF阅读器
请告诉我此解决方案是否适合您的需求
关于android - 在Android中打开pdf文件并在其中搜索word,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17122715/