Good morning,
I found this piece of code to be able to automatically cut the text contained in an EditText before creating my pdf, only it doesn't recognize the textPaint and layout variables and I don't know if it depends on a particular library. Thank you in advance for your help.
I found this piece of code to be able to automatically cut the text contained in an EditText before creating my pdf, only it doesn't recognize the textPaint and layout variables and I don't know if it depends on a particular library. Thank you in advance for your help.
Personnal code:
Dim texte As String = ACEditText1.Text
Dim largeur As Int = 550 ' largeur de la zone de dessin en pixels
Dim textPaint As Paint
textPaint.Initialize
textPaint.TextSize = 14 / GetDeviceLayoutValues.Scale ' taille du texte en dp
Dim layout As StaticLayout
layout.Initialize(texte, textPaint, largeur, Layout.Alignment.ALIGN_NORMAL, 1.0, 0.0, False)
Dim ligneCount As Int = layout.LineCount
Dim yPos As Int = 220
For i = 0 To ligneCount - 1
Dim lineStart As Int = layout.GetLineStart(i)
Dim lineEnd As Int = layout.GetLineEnd(i)
Dim lineText As String = texte.SubString2(lineStart, lineEnd)
pdf.Canvas.DrawText(lineText, 300, yPos, Typeface.DEFAULT, 14 / GetDeviceLayoutValues.Scale, Colors.Black, "CENTER")
yPos = yPos + layout.GetLineBottom(i) - layout.GetLineTop(i)
Next