Dim pdfInfo As PageInfo
Dim pdfRect As Rect
pdf.Initialize("")
pdfRect.Initialize(10,10,585,832)
pdfInfo.Initialize(595,842,1,pdfRect)
Dim pdfPage As Page = pdf.startPage(pdfInfo)
cv = pdfPage.Canvas ' cv is initialized in Activity_Create because I use it all the time.
pdfFontFace = Typeface.SANS_SERIF
pdfFontSize = 8
pdfFontAlign = "LEFT"
Outprint("Hello There!",570,0,0,False)
...
Sub Outprint(inText As String, inX As Int, inY As Int, MaxWidth As Int, fFit As Boolean)
Dim subX As Int = inX
Dim subY As Int = inY + 15
Dim tWidth As Int = cv.MeasureStringWidth(inText,pdfFontFace,pdfFontSize)
If MaxWidth<>0 Then
Do Until tWidth < MaxWidth
inText = s.Left(inText,inText.Length-1)
tWidth = cv.MeasureStringWidth(inText,pdfFontFace,pdfFontSize)
Loop
End If
DrawMultilineText(cv, inText, subX, subY, pdfFontFace, pdfFontSize, Colors.Black, pdfFontAlign, 0dip)
End Sub