How To Open Pdf From Url Online In Android Without Download Option?
In my app I want the user to read the pdf files inside my app without any option to download them. How can I do this? I am using the following code but not working- WebView webView
Solution 1:
You can open pdf from URL online in Android without a download option.
Kotlin
val path="https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf"
activityWebViewBinding.webview.settings.loadWithOverviewMode = true
activityWebViewBinding.webview.settings.javaScriptEnabled = trueval url = "https://docs.google.com/gview?embedded=true&url=$path"
activityWebViewBinding.webview.loadUrl(url)
Java
String path="https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf";
webview.settings.setLoadWithOverviewMode(true);
webview.settings.setJavaScriptEnabled(true);
String url = "https://docs.google.com/gview?embedded=true&url"+path;
webview.loadUrl(url);
Post a Comment for "How To Open Pdf From Url Online In Android Without Download Option?"