Dim pdf As PdfDocument
pdf.Initialize
pdf.StartPage(595, 842) 'A4 size
'PrefDialog.CustomListView1.sv.ScrollViewInnerPanel.Height=100%y
Dim bmp As B4XBitmap = PrefDialog.CustomListView1.sv.ScrollViewInnerPanel.Snapshot
Dim dest As Rect
Dim w As Int = bmp.Width / bmp.Scale*0.8
Dim h As Int = bmp.Height / bmp.Scale*0.8
dest.Initialize((595-w)/2, 10, 0, 0)
dest.Width = bmp.Width / bmp.Scale*0.8
dest.Height = bmp.Height / bmp.Scale*0.8
pdf.Canvas.DrawBitmap(bmp, Null, dest)
pdf.FinishPage
Dim out As OutputStream = File.OpenOutput(provider.SharedFolder, "snapshot.pdf", False)
pdf.WriteToStream(out)
out.Close
pdf.Close
Dim in As Intent
in.Initialize(in.ACTION_VIEW, "")
provider.SetFileUriAsIntentData(in, "snapshot.pdf")
in.SetType("application/pdf")
StartActivity(in)