You can also use: clv1.sv.Snapshot. You will capture more of the clv if the clv is not a mile long.I'll try to dig on this side.
clv1.sv.Height=3000dip
Dim bmp As B4XBitmap=clv1.sv.Snapshot
Private Sub ButtonEnvoyer_Click
CustomListView1.sv.Height=3000dip
Dim bmp As B4XBitmap=CustomListView1.sv.Snapshot
Dim DestRect As Rect
pdf.Initialize
pdf.StartPage(595, 842) 'A4 size
pdf.Canvas.DrawLine(2, 2, 593 , 840, Colors.Blue, 4)
pdf.Canvas.DrawText("Hello", 100, 100, Typeface.DEFAULT_BOLD, 30 / GetDeviceLayoutValues.Scale , Colors.Yellow, "CENTER")
pdf.Canvas.DrawBitmap(bmp, Null, DestRect)
pdf.FinishPage
Dim out As OutputStream = File.OpenOutput(File.DirInternal, "Ronde.pdf", False)
pdf.WriteToStream(out)
out.Close
pdf.Close
End Sub
Private Sub ButtonEnvoyer_Click
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
CustomListView1.sv.Height=3000dip
Dim bmp As B4XBitmap=CustomListView1.sv.Snapshot
pdf.Initialize
pdf.StartPage(595, 842) 'A4 size
pdf.Canvas.DrawLine(2, 2, 593 , 840, Colors.Blue, 4)
pdf.Canvas.DrawText("Hello", 100, 100, Typeface.DEFAULT_BOLD, 30 / GetDeviceLayoutValues.Scale , Colors.Yellow, "CENTER")
DestRect.Initialize(30, 30, 0, 0)
DestRect.Width = bmp.Width / bmp.Scale
DestRect.Height = bmp.Height / bmp.Scale
pdf.Canvas.DrawBitmap(bmp, Null, DestRect)
pdf.FinishPage
Dim out As OutputStream = File.OpenOutput(File.DirInternal, "Ronde.pdf", False)
pdf.WriteToStream(out)
out.Close
pdf.Close
End If
End Sub
I am not familiar with pdf library, what I can tell you is.:but no pdf file is created on the internal storage.
Permission has become very complex the last few Android OS versionsit gives me this error
SetApplicationAttribute(android:requestLegacyExternalStorage, true)
Private Sub ButtonEnvoyer_Click
rp.CheckAndRequest(rp.GetSafeDirDefaultExternal("Download/"))
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
CustomListView1.sv.Height=3000dip
Dim bmp As B4XBitmap=CustomListView1.sv.Snapshot
pdf.Initialize
pdf.StartPage(595, 842) 'A4 size
pdf.Canvas.DrawLine(2, 2, 593 , 840, Colors.Blue, 4)
pdf.Canvas.DrawText("Hello", 100, 100, Typeface.DEFAULT_BOLD, 30 / GetDeviceLayoutValues.Scale , Colors.Yellow, "CENTER")
DestRect.Initialize(30, 30, 0, 0)
DestRect.Width = bmp.Width / bmp.Scale
DestRect.Height = bmp.Height / bmp.Scale
pdf.Canvas.DrawBitmap(bmp, Null, DestRect)
pdf.FinishPage
Dim out As OutputStream = File.OpenOutput(File.DirRootExternal, "Ronde.pdf", True)
pdf.WriteToStream(out)
out.Close
pdf.Close
End If
End Sub
Did you get a chance to read post #10.I even tried both but it doesn't change anything the pdf file doesn't create it.
Private Sub ButtonEnvoyer_Click
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
CustomListView1.sv.Height=3000dip
Dim bmp As B4XBitmap=CustomListView1.sv.Snapshot
pdf.Initialize
pdf.StartPage(595, 842) 'A4 size
pdf.Canvas.DrawLine(2, 2, 593 , 840, Colors.Blue, 4)
pdf.Canvas.DrawText("Hello", 100, 100, Typeface.DEFAULT_BOLD, 30 / GetDeviceLayoutValues.Scale , Colors.Yellow, "CENTER")
DestRect.Initialize(30, 30, 0, 0)
DestRect.Width = bmp.Width / bmp.Scale
DestRect.Height = bmp.Height / bmp.Scale
pdf.Canvas.DrawBitmap(bmp, Null, DestRect)
pdf.FinishPage
Dim out As OutputStream = File.OpenOutput(File.DirRootExternal, "Ronde.pdf", True)
pdf.WriteToStream(out)
out.Close
pdf.Close
End If
End Sub
You can also use: clv1.sv.Snapshot. You will capture more of the clv if the clv is not a mile long.
B4X:clv1.sv.Height=3000dip Dim bmp As B4XBitmap=clv1.sv.Snapshot