I have uploaded some pdf files to my server and use that url to display pdf in webview in Android app with "http://docs.google.com/gview?embedded=true&url=myurl".
But I am getting error as :
whooopss..Preview not available.
Sometimes it works and sometimes it's giving that error. All my pdf files are made in Acrobat 6.x .
I have used following code ;
url = "http://docs.google.com/gview?embedded=true&url=" + url;
loadUrl(url);
private void loadUrl(String url){
webView = (WebView) findViewById(R.id.webView1);
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
});
webView.setWebChromeClient(new WebChromeClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginState(PluginState.ON);
webView.loadUrl(url);
Sometimes it also gives error as :
Web Console(2448): Uncaught ReferenceError: _init is not defined at http://docs.google.com/gview?embedded=true&url=myurl/system/download/Datasheet_X1Carbon_2015f1201faba8ab0c3da16d9886ec8a0d1d.pdf:1
I have searched a lot about this but could not find any solution.
I can not understand why this happen. Any help to this are appreciable.