Reputation: 1307
I'm trying to open pdf in webview of android,
I tried using :
webView.loadUrl("https://docs.google.com/gview?embedded=true&url="+url)
If url is http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters.pdf
(this is a sample), its working fine,
but if url is http://192.168.x.xxx:8001/ql/Demo/Demo_Rep_DDForm.pdf
its not opening.
Unable to figure out the reason, the above IP is public.
Upvotes: 0
Views: 1308
Reputation: 614
Posting this if it could help someone some day,
As an alternative , In order to view pdf files in android you can make use of the pdf.js which requires you to add the web related files in assets folder which includes the js files in the index.html and call the index.html by passing the url of the pdf file as query parameter and load it in the webview.
Pros: User need not navigate away from the webview You can reuse the same to display PDFs which are hosted in server or available withing the application also you can view pdf which require to login using cookies.
Cons: There will be a slight increase in app size.
Upvotes: 1
Reputation: 82563
the above IP is public
No, it is not. IPs in the range you've provided are internal IP addresses used within a LAN network. Your public IP is something different, and you will have to find that out and use it to serve up your file using Google Docs.
You can get your public IP by simply typing my public ip
into Google.
Additionally, public IPs change quite frequently (unless you're paying extra for a static IP to your ISP), so you would be better of hiring a server, or keeping your file in public domain somewhere to allow unbroken access to it.
Upvotes: 6