android - 在Android中打开pdf文件并在其中搜索word

标签 android pdf-viewer pdfview

我希望能够在我的 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/

相关文章:

flutter - 检测 pdfviewer 内的触摸。当小部件处理自己的触摸事件时强制检测触摸

java - 如何在项目 -> 属性 -> Java 构建路径中添加 Android X

android - Android 应用程序的根权限(完整的应用程序。不仅仅是几个命令)

android - 如何使用 pdfviewer 在 Android Studio 中显示来自 Firebase 的 PDF

javascript - 如何在 Firefox 内置 PDF 查看器上运行用户脚本?

swift - 将 'PageSetupAccessory' 添加到 PDFDocument 的 PrintPanel

c# - 通过 C# .Net 桌面应用程序查看 PDF

cocoa - 将单页 pdf 显示为图像的最佳方式是什么?

android - 可靠地检测 Android 设备上的 PDF 支持

java - Android计算器应用程序阻止相邻的运算符(operator)输入