Re: [iText-questions] How should we write text to the PDF file?
Ok - thanks -Original Message- From: Paulo Soares [mailto:psoa...@glintt.com] Sent: Monday, December 22, 2008 1:21 PM To: Post all your questions about iText here Subject: Re: [iText-questions] How should we write text to the PDF file? As Bruno said use ColumnText. If the text fits in that line (you already checked it) no word wrap will be attempted. Use ALIGN_JUSTIFIED_ALL to justify that line to the end. Paulo > -Original Message- > From: David Thielen [mailto:da...@windward.net] > Sent: Monday, December 22, 2008 6:07 PM > To: Post all your questions about iText here > Subject: Re: [iText-questions] How should we write text to the PDF > file? > > We do all of the page formatting - and have to for setting text in > things like the page on & number of pages field - which we then > convert to text on the output. Plus we've put in a gigantic effort to > match Word and there is a boatload of small weird rules that impact > layout, and iText does not have that level of control. > > So when we say the text must fit on a line - it all must go on that > line. The output we produce is clean so the text we select for a line > does fit - but I can't use an iText call that may decide that the last > word should go on the next line. > > Also, for centered/right/justified text - it has to know that this is > all the text for this line. And for justified text, needs to know if > it is the last line of the paragraph (no justify) or a line before the > last. > > Thanks - dave > > > -Original Message- > From: 1T3XT info [mailto:i...@1t3xt.info] > Sent: Monday, December 22, 2008 12:53 PM > To: Post all your questions about iText here > Subject: Re: [iText-questions] How should we write text to the PDF > file? > > 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 Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. -- ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
Re: [iText-questions] How should we write text to the PDF file?
As Bruno said use ColumnText. If the text fits in that line (you already checked it) no word wrap will be attempted. Use ALIGN_JUSTIFIED_ALL to justify that line to the end. Paulo > -Original Message- > From: David Thielen [mailto:da...@windward.net] > Sent: Monday, December 22, 2008 6:07 PM > To: Post all your questions about iText here > Subject: Re: [iText-questions] How should we write text to > the PDF file? > > We do all of the page formatting - and have to for setting text in > things like the page on & number of pages field - which we > then convert > to text on the output. Plus we've put in a gigantic effort to > match Word > and there is a boatload of small weird rules that impact layout, and > iText does not have that level of control. > > So when we say the text must fit on a line - it all must go on that > line. The output we produce is clean so the text we select for a line > does fit - but I can't use an iText call that may decide that the last > word should go on the next line. > > Also, for centered/right/justified text - it has to know that this is > all the text for this line. And for justified text, needs to > know if it > is the last line of the paragraph (no justify) or a line before the > last. > > Thanks - dave > > > -Original Message- > From: 1T3XT info [mailto:i...@1t3xt.info] > Sent: Monday, December 22, 2008 12:53 PM > To: Post all your questions about iText here > Subject: Re: [iText-questions] How should we write text to > the PDF file? > > 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 Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. -- ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
Re: [iText-questions] How should we write text to the PDF file?
David Thielen wrote: > So when we say the text must fit on a line - it all must go on that > line. OK, then I suggest you do use ColumnText to add each line. Use it in simulation mode first. ColumnText will tell you how many lines it needed if you call the getLinesWritten() method. If you've measured the text yourself, it should always return 1. If it does, add the line for real with ColumnText.go() (not in simulation mode). If it doesn't (but I don't expect it won't), fall back on your initial way of adding text. -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info -- ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
Re: [iText-questions] How should we write text to the PDF file?
We do all of the page formatting - and have to for setting text in things like the page on & number of pages field - which we then convert to text on the output. Plus we've put in a gigantic effort to match Word and there is a boatload of small weird rules that impact layout, and iText does not have that level of control. So when we say the text must fit on a line - it all must go on that line. The output we produce is clean so the text we select for a line does fit - but I can't use an iText call that may decide that the last word should go on the next line. Also, for centered/right/justified text - it has to know that this is all the text for this line. And for justified text, needs to know if it is the last line of the paragraph (no justify) or a line before the last. Thanks - dave -Original Message- From: 1T3XT info [mailto:i...@1t3xt.info] Sent: Monday, December 22, 2008 12:53 PM To: Post all your questions about iText here Subject: Re: [iText-questions] How should we write text to the PDF file? 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 iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php -- ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
Re: [iText-questions] How should we write text to the PDF file?
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 iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
[iText-questions] How should we write text to the PDF file?
Hi; 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. 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. 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? Thanks - dave -- ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php