WebViewDisplay.LoadHtml("<html><body><img src='file:///android_asset/filename.pdf'/></body></html>")
Sub OpenPDF(FileName As String)
Dim i As Intent 'Requires a reference to the Phone library
i.Initialize(i.ACTION_VIEW, FileName)
i.SetType("application/pdf")
i.WrapAsIntentChooser("Choose PDF Viewer")
StartActivity(i)
End Sub
Dim folder As String :folder=File.DirRootExternal 'root of SD card on device
Dim filename As String :filename="Kumar.pdf" 'this is the file name
OpenPDF("file://" & File.Combine(folder, filename))
OpenPDF("file://" & File.Combine(file.DirRootExternal, "filename.pdf"))
File.Copy(File.DirAssets, "Manual.pdf", File.DirDefaultExternal, "Manual.pdf")
OpenPDF("file://" & File.Combine(File.DirDefaultExternal, "Manual.pdf"))
Your way I was successful, ThanksHi Erel,
As you suggested, Copied the file from dirassets to sd card folder, like..
B4X:File.Copy(File.DirAssets, "Manual.pdf", File.DirDefaultExternal, "Manual.pdf") OpenPDF("file://" & File.Combine(File.DirDefaultExternal, "Manual.pdf"))
now its working fine. Thanks.
The emulator cannot access Windows file system.
You can embed the file inside the APK by adding it in the Files tab. It is then accessed with File.DirAssets.
The pdf reader will not be able to read an internal file. You will need to first copy the file from the assets folder to the storage card.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?