Wish PDF Viewer with zoom and scroll

johan vetsuypens

Member
Licensed User
Longtime User
In B4A you could use the below intent to view a PDF file. Would be nice to have the same functionality in B4i

Dim i As Intent 'Requires a reference to the Phone library
i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirRootExternal , "data.pdf"))
i.SetType("application/pdf")
i.WrapAsIntentChooser("Choose PDF Viewer")
StartActivity(i)
Activity.Finish

Thanks,
Johan
 

johan vetsuypens

Member
Licensed User
Longtime User
Do the zoom gesture zoom.png
 

shashkiranr

Active Member
Licensed User
Longtime User
Have you tried to just load the pdf to the WebView? I expect it to work:
B4X:
WebView1.LoadUrl("file://" & File.Combine(File.DirAssets, "yourpdf.pdf"))

Hi Erel,

When i try the above code, only a white screen appears.

Regards,
SK
 

shashkiranr

Active Member
Licensed User
Longtime User
Yes Erel. It does. I have attached the project. I feel i am doing some stupid mistake.

Regards,
SK
 

Attachments

  • dummy2.zip
    22.8 KB · Views: 313

mtechteam

Member
Licensed User
Longtime User
Erel,

We have the same issue. Our quirk is that it works great in debug but not in release. This is b4i, whether 1.x or 2.0. Any thoughts? Here is a file with the pertinent code.

Tm
 

Attachments

  • snippet.txt
    270 bytes · Views: 261

mtechteam

Member
Licensed User
Longtime User
Sorry, should have thought about doing that. Here it is. Running in debug works, but not in release.

Thanks,
Tm
 

Attachments

  • PDFInWebview.zip
    172 KB · Views: 352
Top