ziovec Member Licensed User Jan 4, 2021 #1 Hello there! I'm using jpdfjet to generate a pdf document from a web server. I noticed that when I'm drawing a pdf line with a string as input, it doesn't take care of the lenght of the strings, and that result in a very awful pdf :\ This is the way I'm drawing the line: B4X: pdfLine2.SetFont(HelveticaItalic14) pdfLine2.SetPosition(15, 15+pdfLine2.GetDestinationY+HelveticaItalic14.GetHeight) pdfLine2.SetText($"«${nota}»"$) pdfLine2.DrawOn(PDFPage) Variable $nota is a string created from an html input text: B4X: Dim f As Future = txtNota.GetVal nota = f.Value It can be infinite long and can contain multiple break lines (wich would be cool to track in order to re-write the string as the user initially intended). How can I automatically draw more lines when the string lenght is over a certain value? I should be able to tell how many lines are needed given the length of the string, I guess...any suggestion?
Hello there! I'm using jpdfjet to generate a pdf document from a web server. I noticed that when I'm drawing a pdf line with a string as input, it doesn't take care of the lenght of the strings, and that result in a very awful pdf :\ This is the way I'm drawing the line: B4X: pdfLine2.SetFont(HelveticaItalic14) pdfLine2.SetPosition(15, 15+pdfLine2.GetDestinationY+HelveticaItalic14.GetHeight) pdfLine2.SetText($"«${nota}»"$) pdfLine2.DrawOn(PDFPage) Variable $nota is a string created from an html input text: B4X: Dim f As Future = txtNota.GetVal nota = f.Value It can be infinite long and can contain multiple break lines (wich would be cool to track in order to re-write the string as the user initially intended). How can I automatically draw more lines when the string lenght is over a certain value? I should be able to tell how many lines are needed given the length of the string, I guess...any suggestion?
A AHilton Active Member Licensed User Longtime User Jan 4, 2021 #2 Just create yourself a Wordwrap function that splits up your string into lengths that you know your document space can handle by putting CRLF at the breaks. When you get back from that function, split up that string that was passed back with Regex.Split to give a string array. Then loop over that string array with your .SetPosition and .SetText. Upvote 0
Just create yourself a Wordwrap function that splits up your string into lengths that you know your document space can handle by putting CRLF at the breaks. When you get back from that function, split up that string that was passed back with Regex.Split to give a string array. Then loop over that string array with your .SetPosition and .SetText.
Harris Expert Licensed User Longtime User Jan 4, 2021 #3 Read this: Html script to pdf document Hi all Is there a way to programmatically convert html script to a pdf document ? I.e : Html2pdf("hello", "1.pdf") Thanks www.b4x.com Upvote 0
Read this: Html script to pdf document Hi all Is there a way to programmatically convert html script to a pdf document ? I.e : Html2pdf("hello", "1.pdf") Thanks www.b4x.com
ziovec Member Licensed User Jan 4, 2021 #4 Harris said: Read this: Html script to pdf document Hi all Is there a way to programmatically convert html script to a pdf document ? I.e : Html2pdf("hello", "1.pdf") Thanks www.b4x.com Click to expand... Thank you but...I can't see how could be useful in my case ? Right now I'm working on a solution based on @AHilton 's suggestion...even though I'm not very comfortable with loops Upvote 0
Harris said: Read this: Html script to pdf document Hi all Is there a way to programmatically convert html script to a pdf document ? I.e : Html2pdf("hello", "1.pdf") Thanks www.b4x.com Click to expand... Thank you but...I can't see how could be useful in my case ? Right now I'm working on a solution based on @AHilton 's suggestion...even though I'm not very comfortable with loops