JackSparrow
Member
Greetings All
I am having a problem creating a simple pdf doc. All I am trying to do is create a document with many lines. I thought a new line would be generated each time I performed pdf.Canvas.DrawText but not so
If I just print one line inside the loop (x=1 to1) it is fine
I tried appending a crlf but that didn't work
I tried the s.Initialize inside and outside the loop but no effect
I have done a search but all examples seem to just show a single line output
what am I missing here?
Thanks for any suggestions
I am having a problem creating a simple pdf doc. All I am trying to do is create a document with many lines. I thought a new line would be generated each time I performed pdf.Canvas.DrawText but not so
If I just print one line inside the loop (x=1 to1) it is fine
I tried appending a crlf but that didn't work
I tried the s.Initialize inside and outside the loop but no effect
I have done a search but all examples seem to just show a single line output
what am I missing here?
Thanks for any suggestions
B4X:
Dim pdf As PdfDocument
pdf.Initialize
pdf.StartPage(595, 842) 'A4 size
Dim x As Int
Dim s As StringBuilder
For x = 1 To 10
s.Initialize
s.Append(x).Append(" ").Append(P1Map1.Get("Hola" & x)).Append(" ").Append(P1Map2.Get("Hola" & x)).Append(" ")
s.Append(P2Map1.Get("Hola" & x)).Append(" ").Append(P2Map2.Get("Hola" & x)).Append(" ").Append(CRLF)
pdf.Canvas.DrawText(s,100,100,Typeface.DEFAULT_BOLD, 30 / GetDeviceLayoutValues.Scale , Colors.Blue, "LEFT")
Next
pdf.FinishPage
Dim out As OutputStream = File.OpenOutput(File.DirInternal, "1.pdf", False)
pdf.WriteToStream(out)
out.Close
pdf.Close