i am trying to load pdf in webview from my sdcard but it gives message
" Sorry, we were unable to find the document at the original source. Verify that the document still exists! "
i also googled this but after banging my head a lot i got nothing than this one and this one ...
webView = (WebView) findViewById(R.id.webview_compontent);
fill_form = (Button) findViewById(R.id.fill_form);
fill_form.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "In Progress", Toast.LENGTH_LONG).show();
}
});
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
// webView.getSettings().setUseWideViewPort(true);
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
progDailog.show();
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, final String url) {
progDailog.dismiss();
}
});
// String fileurl = Environment.getExternalStorageDirectory()+File.separator +"pk.pdf";
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"pk.pdf");
Uri fileurl = (Uri.fromFile(file));
String Url = "http://docs.google.com/gview?embedded=true&url=" + fileurl;
webView.loadUrl(Url);
}
Please give any idea how to do this ?(I don't want to use any payable rendering library.)
I don't think that webview can load a pdf for you. Sso you still have two options: 1. Try to ask other applications to view this PDF for you. 2. You can try this librarry https://github.com/JoanZapata/android-pdfview if GNU policy suits you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.