Open PDFs in WebView - android

I am trying to build an app using Flutter that uses the Webview to open a website. Within this website there are a number of pdfs and I want to open them inside the app as well, instead of redirecting to a browser or an acrobat viewer. Is there any way to do this?

Related

How to Open link inside PDF page in android app using android Pdf viewer library

I am making one PDF reader app.
I am using android pdfViewer library
com.github.barteksc:android-pdf-viewer:2.8.2
My issue is their are some links inside my PDF pages. when user clicks on it the link should open in phone's default browser.
Note: I am not using Webview. PDFs are simply stored in assets folder and i am loading it from that folder

React PWA cannot open external PDF in Chrome (Android)

I have a React progressive web app which contains a link to a PDF file. The app has been added to the home screen using the Google banner (https://developers.google.com/web/updates/images/2015/12/getting-started-pwa/pwa-general-2-#1x.jpg), so it is treated as an app, not a shortcut.
The problem is I cannot open the PDF file from the installed PWA on Android. I get an error saying: Cannot open PDF (pdf_name.pdf cannot be opened).
Opening the PDF from a regular browser (desktop or mobile) works. Opening from home screen app on iOS also works.
My PWA is hosted at app.domain.com, while the PDF is hosted at api.domain.com.
The link to the PDF file looks like this:
<a rel="noopener" href="https://api.domain.com/pdf_name.pdf"
target="_blank">View PDF</a>
External links that go to regular pages (not files) work.
Any ideas what might prevent Chrome from being opened from within the app?
I fixed this by simply removing the target attribute. It opens up in a new tab anyway. For PWA's on Android, specifying a new tab with the target attribute causes an error. It seems that when you manually specify a new tab the browser reacts as if there are 2 pages to download, the pdf and an empty web page (0 kb). Oddly, the Samsung Internet Browser also does this but just downloads both. The PWA Chrome Browser errors instead.

Android Webview with link new tab

Let's say I have an Android app that uses a webview. Inside that webview I have a link to download a PDF file like so:
<a href="LinkToDownloadPDF" target="_blank".../>
In a browser (Say Chrome for example), this will either download the file or opens it in a new tab.
My question is, what will happen once the webview is charged in the Android app? Will it download the file or open the web browser?
Nothing will happen when you download from webview without setting the download listener.
If you want to implement the feature of downloading something inside WebView, have a look at this question: Download File inside WebView

Opening an Android Application from a PDF possible?

I was wondering how to open an android APP from a PDF. I wanted to make a PDF document for kids that would automatically open the application when the child pressed on the apps button on the PDF document. I can generate links in the PDf that will make it open videos and go to web pages, but not that could open an application already installed on the tablet.

How to open pdf file with in our app android+phonegap+JQM?

I am developing an web+cross platform app using Jquery Mobile+PhoneGap+Android. In web app, I am able to open pdf file links within my app page using iframe. But, in Phonegap generated Android build, iframe is unable to render pdf content,it is showing that iframe area as empty.How can I display the pdf file/content, whose src I know at runtime, within android webview. Thanks In Advance.
I've just published my plugin, which can open almost any type of file, which is stored locally on Android device.
Please take a look at: https://github.com/markeeftb/FileOpener
Plugin opens external application which handles the preview of the document.

Categories

Resources