Question

I want to be able to open pdf files in my android and search for a specific word either in English or Arabic.. how to do that in code and what is the best pdf viewer to do search?

Was it helpful?

Solution

Try This to open a pdf file

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(); 
                    }
                }

You can find PDF reader based on your requirement from this link

Plz let me know if this solution suits your need

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top