Reputation: 65
I have to display a pdf from URL. When i directly open the url in a webview then it asks me to download the pdf and then view based on the app that i want to use to view it. But I do not want to download the pdf, it must be just displayed directly.
Some answers that I went through on SO recommended to make use of docs.google.com
like here: How to display a PDF via Android web browser without "downloading" first
But this doesnt seem to be working anymore.
Upvotes: 1
Views: 7100
Reputation: 1
use this inside your body tags
<iframe src="http://example.com/yourpdf" width="100%" height="100%" style="border: none;">This browser does not support PDFs. Please download the PDF to view it: <a href="http://example.com/yourpdf">Download PDF</a></iframe>
Upvotes: 0
Reputation: 2260
Use this one:
https://docs.google.com/viewer?url=[url_pdf]
eg. webview.loadUrl("https://docs.google.com/viewer?url=https://www.unipg.it/files/pagine/410/4-PDF-A.pdf");
Upvotes: 1