1

how to get pdf from internal storage in android Using WebView or AnyConcept. i have to get pdf in an activity from internal storage.Can anyone of u guys let me know about this .Thank You.

Pavya
  • 6,015
  • 4
  • 29
  • 42
  • there is no no native way of displaying a "local" pdf from within an andrioid activity. – Hector Mar 22 '17 at 05:31
  • 2
    There are number of ways by which you can view PDF. 1)Using Web View 2)Using android PdfRenderer class (https://developer.android.com/reference/android/graphics/pdf/PdfRenderer.html) 3)You can use JavaScript(https://github.com/loosemoose/androidpdf) 4)You can use android Open source library for PDF reader. – ViramP Mar 22 '17 at 05:37
  • Thnak you Viram Will Check and let u know – Programing World Mar 22 '17 at 05:54
  • hi viram,what u gave the second link is copy data from asstes and display using webview. – Programing World Mar 22 '17 at 06:21

1 Answers1

0

String filename = null;
                File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() +"/"+ filename);
                Intent target = new Intent(Intent.ACTION_VIEW);
                target.setDataAndType(Uri.fromFile(file),"application/pdf");
                target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);

                Intent intent = Intent.createChooser(target, "Open File");
startActivity(intent);

and give pdf filename

Karthik
  • 102
  • 13