Android Question Display WebView in PDF Document

ST500

Active Member
Licensed User
Hi,

could you show me how I can integrate a WebView into a PDF-Document, please?
The WebView Contents a SQLite table.

Thanks a lot.

Martin
 

ronell

Well-Known Member
Licensed User
Longtime User
you want to save the webview(.html file?) to pdf?

please clarify your question , (or maybe im the only one who didnt get it lol)
 
Upvote 0

ST500

Active Member
Licensed User
My activity shows a WebView, that I want save to pdf.
The same goes for the signature capture from this activity.
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
B4X:
Sub Globals

    Dim wvImage As Bitmap
    Dim iv As ImageView
  
    Private wv As WebView
End Sub

Sub Activity_Create(FirstTime As Boolean)
 
Activity.LoadLayout("main")                      'add the views in designer

        wv.LoadUrl("http://www.google.com")
  

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub wv_PageFinished (Url As String)
    wvImage = wv.CaptureBitmap
    iv.Bitmap = wvImage
    Dim out As OutputStream
    out = File.Openoutput(File.DirRootExternal,"WebImage.png",False)
    wvImage.WriteToStream(out,100,"PNG")
    out.Close
End Sub

in this example , webview content will be saved in your phone storage as image(.png)
if you want to save it as pdf then i think you can use this lib
 
Upvote 0

ST500

Active Member
Licensed User
Thanks a lot.

I would like to generate a Report in A4 Landscape. What's to do when the exported WebView is to big for one page. How can I insert a break into the png file?
 
Last edited:
Upvote 0
Top