I have a document stored in an HTML file which I wish to add to a PDF.
I am reading the HTML into a string.
Loading it to a webview
Using Webview.CAptureBitmap
then using pdf.canvas.drawbitmap
But I get the error "java.lang.IllegalArgumentException: width and height must be > 0"
on the webview1.capturebitmap line
Thanks in advance Geoff
I am reading the HTML into a string.
Loading it to a webview
Using Webview.CAptureBitmap
then using pdf.canvas.drawbitmap
But I get the error "java.lang.IllegalArgumentException: width and height must be > 0"
on the webview1.capturebitmap line
B4X:
Dim pdf As PdfDocument
Dim webview1 As WebView
Dim Bitmap1 As Bitmap
Dim htmlFileString As String
Dim Out As OutputStream
Dim DestRect As Rect
webview1.Initialize("")
htmlFileString = File.ReadString(File.DirDefaultExternal, GlobFileName)
pdf.Initialize
pdf.StartPage(595, 842) 'A4 size
webview1.LoadHtml(htmlFileString)
webview1.Visible=True
Out = File.OpenOutput(File.DirDefaultExternal, "Scorecard.png", False)
webview1.CaptureBitmap.WriteToStream(Out, 100, "PNG")
Out.Close
Bitmap1.Initialize(File.DirDefaultExternal, "Scorecard.png")
DestRect.Initialize(5,5,580,450)
pdf.Canvas.DrawBitmap(Bitmap1,Null,DestRect)
Thanks in advance Geoff