Android Question Show downloaded pdf into webview

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hello,
i need to download a pdf file from the net and then show it to the usr.
I tried to use a web view, but the log result is null:

This is my code:
B4X:
Dim DOWNLOAD_ADDRESS As String = "http://www.testwebsite.com/pdf-test.pdf"

Dim wb As WebView
wb.Initialize("wb")
Activity.AddView(wb, 5, 5, 50%x, 50%y)
wb.LoadUrl(DOWNLOAD_ADDRESS)
Log(wb.Url)

It could be better, if the DOWNLOAD_ADDRESS variable, would be the file into DirRootExternal
 

eurojam

Well-Known Member
Licensed User
Longtime User
it means:
B4X:
Dim DOWNLOAD_ADDRESS As String = "https://docs.google.com/viewer?url=http://www.testwebsite.com/pdf-test.pdf"

Dim wb As WebView
wb.Initialize("wb")
Activity.AddView(wb, 5, 5, 50%x, 50%y)
wb.LoadUrl(DOWNLOAD_ADDRESS)
Log(wb.Url)

but I haven't tested it...o_O
If you want to download the pdf, you'll better use httputils and something like an intent to a pdf viewer...
 
Upvote 0

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
it means:
B4X:
Dim DOWNLOAD_ADDRESS As String = "https://docs.google.com/viewer?url=http://www.testwebsite.com/pdf-test.pdf"

Dim wb As WebView
wb.Initialize("wb")
Activity.AddView(wb, 5, 5, 50%x, 50%y)
wb.LoadUrl(DOWNLOAD_ADDRESS)
Log(wb.Url)

but I haven't tested it...o_O
If you want to download the pdf, you'll better use httputils and something like an intent to a pdf viewer...

I prefer using a download manager.
Also I don't want to use a third part application
 
Upvote 0

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Do you know, if it possible, also to use google viewer, with internal file?
 
Upvote 0
Top