Displaying a PDF within the Webview
See original GitHub issueBug description:
I have a WebView Container for my Webpage. Within my webpage, I link specific PDFs, just as a direct link via <a href="...pdf">My Link</a>
How can I force the WebView to display the PDF upon clicking it? Right now, the link is opened in my default browser and from there being downloaded as file. As the Webview is, e.g. on Android, based on Chromium, I’d expect Chromium just to show the PDF within the Webview / APP natively.
To Reproduce: Nothing special required, just a pure Webview and a HTML Page with a linked PDF.
Expected behavior: As the Webview is, e.g. on Android, based on Chromium, I’d expect Chromium just to show the PDF within the Webview / APP natively.
Environment:
- OS: Android 11 “react”: “17.0.1”, “react-native”: “0.64.3”, “react-native-safe-area-context”: “3.3.2”, “react-native-web”: “0.17.1”, “react-native-webview”: “11.15.0”
Thank you so much!
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
android - How can I display a pdf document into a Webview?
You can use Google PDF Viewer to read your pdf online: WebView webview = (WebView) findViewById(R.id.webview); webview.getSettings().
Read more >Various ways to load PDF in Android webview - django-cas-ng
Various ways to load PDF in Android webview · Open Intent with startActivity · Use google docs service to load pdf in html...
Read more >How to show pdf in android webview? - Tutorialspoint
This example demonstrate about How to show pdf in android webview. Step 1 − Create a new project in Android Studio, go to...
Read more >Load PDF in Android WebView - Codes Easy
We can load PDF in android easily using WebView. We will be using the simplest way for displaying PDF file in android.
Read more >How to open a PDF file in Android programmatically? - MindOrks
If you want to display PDF in your Android application, ... and the easiest way of displaying the PDF file is to display...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bjspi I’m not personally aware of any such library (that doesn’t mean none exist though, just that I can’t help you), we just let third-party apps handle it for us, as there are many of those (when I try to open a PDF on my personal phone I get a list of ~8 different apps to choose from!)
@bjspi PDF viewing is not a feature of the Android Webview or even of the Chrome browser on Android.