David Thielen wrote: > At present we write to the document using ColumnText.showTextAligned(). > We pass in the X, Y of the start of the text and in the case of > justified text, call it word by word. We then also draw underlines > ourselves afterwards.
Wow, that's a lot of work. > I would prefer that we could call an iText method a line at a time and > give it the start & end of the line, if it’s left, center, right, or > justified aligned, and if it’s underlined. But it would not word wrap – > it would put everything on that one line. If you dropped the requirement "it would not word wrap", I'd say: that's easy. Please explain why you want to avoid word wrap. For instance: what happens when the text doesn't fit the line? (How) do you know the text will only take one line? Depending on your answers to this question, the solution could already be present, but I don't know. > Is there a way to do this? And if not, is our present approach using > ColumnText.showTextAligned() setting the left of each string the best > approach? I'd use ColumnText, but not ColumnText.showTextAligned(). I'd use setSimpleColumn to define a Rectangle that takes one line. Then I'd call ColumnText.go(). If the text doesn't fit the line, the remaining part is still in the ColumnText object for you to use in another Rectangle. -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
