android - Cannot call Pdf from Html in my WebView -


i have terms , conditions page uses webview display terms in html. loaded -

    webview webview = (webview) findviewbyid(r.id.webview);     webview.getsettings().setbuiltinzoomcontrols(true);     webview.getsettings().setsupportzoom(true);     webview.getsettings().setusewideviewport(true);     webview.loadurl("file:///android_asset/termsandconditions.html"); 

also in assets folder maintermsandconditions.pdf called link in html this

<a href="file:///android_asset/maintermsandconditions.pdf">main terms</a> 

the problem though pdf in assets folder, nothing happens when click link. i've tried adding target="_blank" still won't work.

what doing wrong

if whant dispaly pdf in webview free have options:

1) using google .you have host file , load special link app:

url = "https://docs.google.com/gview?embedded=true&url=" + urlofyourpdf; 

2) use pdf.js. have import lib , add assets folder. in html have link library. can set in body pdf file assets.

you can try : https://github.com/googlesamples/android-pdfrendererbasic, api 21 , above.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -