android - How to Open PDF/Docx in WebView -
i'm trying allow user click on pdf/doc link , able see directly inside webview. code:
webview.setdownloadlistener(new downloadlistener(){ @override public void ondownloadstart(string url, string useragent, string contentdisposition, string mimetype, long contentlength) { webview.loadurl("https://docs.google.com/gview?embedded=true&url="+url); } });
this correctly opens google viewer (i've tried google viewer), contents show html source code, not pdf/doc. can tell me i'm doing wrong this?
i don't believe android webview knows how display pdf, docx, or other "non-native-web" document formats. you'd have pass url application view it, or download , pass local file other application.
Comments
Post a Comment