'Code to open the file - Dim pdf As PdfDocument, DestRect As Rect
#If B4A
D = File.DirInternal
#ELSE IF B4I
D = File.DirDocuments
#END IF
If File.Exists(D, "YourFileName.pdf") Then
File.Delete(D, "YourFileName.pdf")
End If
#If B4A
ProgressDialogShow2("Formatting Page 1", False)
pdf.Initialize
pdf.StartPage(612, 792) ' (8.5 in × 11 in).
#ELSE IF B4I
HUD.ProgressDialogShow("Formatting Page 1")
Dim PDFCanvas As Canvas
pdf.Initialize(D, "ALAPhone.pdf")
PDFCanvas.InitializePDF(D, "ALAPhone.pdf", 612, 792)
#END IF
Sleep(1)
'Code to snapshot the scrollview (PrintCLD)
bmp = PrintCLV.sv.ScrollViewInnerPanel.Snapshot
'This determines whether it is column 1 or two
If Y Mod 2 = 0 Then
DestRect.Initialize(40, FPColTop, 305, (LineHeight * PrintCLV.Size) + FPColTop - 10) '(612W, 792H) 297
Else
DestRect.Initialize(305, FPColTop, 572, (LineHeight * PrintCLV.Size) + FPColTop - 10) '(612W, 792H) 297
End If
RowsLeft = TotalRows - X
'Now draw it on the pdf
#If B4A
pdf.Canvas.DrawBitmap(bmp, Null, DestRect)
If (Floor(Y / 2) + 1) > 1 Then pdf.Canvas.DrawText($"(${NumberFormat((Floor(Y / 2) + 1), 1, 0)})"$, (612 / 2), DestRect.Bottom + 30, Typeface.DEFAULT, 5, xui.Color_Black, "CENTER")
If OfficersCB.Checked = True Then
pdf.Canvas.DrawText($"(S)-Secretary, (T)-Treasurer, (L)-Literature, (G)-Group Rep, (A)-Phone List Admin"$, (612 / 2), DestRect.Bottom + 12, Typeface.DEFAULT, 3, xui.Color_Black, "CENTER")
End If
pdf.Canvas.DrawLine(DestRect.Left, DestRect.Bottom, DestRect.Right - 1, DestRect.Bottom - 1, xui.Color_Black, .5)
#ELSE IF B4I
PDFCanvas.DrawBitmap(bmp, DestRect)
If (Floor(Y / 2) + 1) > 1 Then PDFCanvas.DrawText($"(${(Floor(Y / 2) + 1)})"$, (612 / 2), DestRect.Bottom + 40, Font.CreateNew(20), xui.Color_Black, "CENTER")
If OfficersCB.Checked = True Then
PDFCanvas.DrawText($"(S)-Secretary, (T)-Treasurer, (L)-Literature, (G)-Group Rep, (A)-Phone List Admin"$, (612 / 2), DestRect.Bottom + 15, Font.CreateNew(12), xui.Color_Black, "CENTER")
End If
PDFCanvas.DrawLine(DestRect.Left, DestRect.Bottom, DestRect.Right - 1, DestRect.Bottom - 1, xui.Color_Black, 1)
PDFCanvas.Refresh
#END IF
'code to finish a page and start the next page
#If B4A
pdf.FinishPage
' #ELSE IF B4I
' PDFCanvas.NextPDFPage 'B4i only needs NextPdfPage, Not finishpage AND startPAge
#END IF
#If B4A
pdf.StartPage(612, 792)
#ELSE IF B4I
PDFCanvas.NextPDFPage
#END IF
'Code to 'close' the pdf file
#If B4A
pdf.FinishPage
#ELSE IF B4I
PDFCanvas.Release
#END IF