My b4xtable has 5 pages. I want to take snapshot of each page(1 through 5) programmatically, on pressing a button, and converting to 5 pages of pdf. I tried :
But, I am getting 5 pdf pages in pdf file of page no 1 only. Any help ?
B4X:
Sub button1_click
Dim pdf As PdfDocument
pdf.Initialize
Dim u as int
For u=1 To 5
B4XTable1.CurrentPage=u
Dim bmp As B4XBitmap=B4XTable1.mBase.Snapshot
pdf.StartPage(595, 842) 'A4 size
Dim Rect1 As Rect
Rect1.Initialize(5dip, 40dip, 595-5dip, 420-5dip)
pdf.Canvas.DrawBitmap(bmp, Null, Rect1) 'draws the bitmap to the destination rectangle.
pdf.FinishPage
Next
Dim out As OutputStream = File.OpenOutput(s.GetSafeDirDefaultExternal("yo"), DateTime.Now&".pdf", False)
pdf.WriteToStream(out)
out.Close
pdf.Close
ToastMessageShow("check snapshot.example/.pdf",False)
But, I am getting 5 pdf pages in pdf file of page no 1 only. Any help ?