Android Question PDF Viewer From URL

nicieri

Active Member
Licensed User
Longtime User
Hello!, I have an app that must display many pdfs in different situations, loading them from different urls.

There is no point in saving it on the device, because there are many of them and they should only be visible.

In B4i, I use a simple webview and it works perfectly, but in B4A?

It is important not to have to download them.

Any simple solution? Thank you so much.
 

nicieri

Active Member
Licensed User
Longtime User
I may be referring to the pdfium function to load from a stream, but I can't get it to work.


B4X:
                Dim url As String = cdata.Get("pdfUrl")
                    Dim job As HttpJob
                    job.Initialize("DownloadPDF", Me)
                    job.Download(url)
                    Wait For (job) JobDone(job As HttpJob)
                    If job.Success Then
                        PDFView1.fromStream(job.GetInputStream)
                        job.GetInputStream.Close ' Asegúrate que esta es la manera correcta de manejar el cierre
                    Else
                        Log("Error downloading PDF: " & job.ErrorMessage)
                    End If
                    job.Release
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
B4X:
    Dim pdfUrl As String = "https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf"
    webview.Loadurl("https://docs.google.com/gview?embedded=true&url=" & pdfUrl)
 

Attachments

  • pdf.png
    52.5 KB · Views: 81
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…