Thank you Paulo, increasing the right border of the columnText is a good idea, 
since the widest paragraph shouldn't go over that line anyway.

But I don't know what else might be going on, I believe my code is correct.
Increasing the right border by 0.01 points is the first value that worked 
(that's less than the 0.05 before, but more than your suggested 0.0001).
So as you can see it's a very unstable value.

Anyway, it should work for me now, thank you!

greetings from Germany,
ciao M. Baumann

On 20.08.2008 22:45, Paulo Soares psoares-at-consiste.pt |iText Mailinglist| 
wrote:
> 0.0001 points should be enough, there's something else going on. In any case 
> you may increase the right border to avoid wrapping.
> 
> Paulo
> 
> ----- Original Message ----- 
> From: <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Wednesday, August 20, 2008 8:57 PM
> Subject: Re: [iText-questions] unwanted wrapping / false width in ColumnText
> 
> 
> Hello Paulo, thanks for your quick answer!
> 
> I already tried that, as you can see in the part 
> "getPointsFromMM(210)-marginRight-max_par_width-0.025f".
> 
> The problem is that for a normal email address 0.025 points was enough 
> (0.0001 not). But than I put in a wider String, e.g. an internet-address, 
> and I saw that the text is wrapping again. So I had to increase the 
> additional width to 0.05 points.
> So it's not a fix value I can add to the width, is variable (obviously it 
> depends, the wider the paragraph the more I have to add), which is a 
> problem. I cannot add a whole lot just to make sure it fits, lets say a 
> millimeter, because then you can already notice the difference at the right 
> side (not a clean and straight page-end).
> 
> Do you know if I can find out the exact additional value I need?
> 
> Otherwise I will have to add an amount that you can't see, and hope that the 
> text a user puts in is not too long so it doesn't wrap. But I would like to 
> make that sure.
> 
> Thanks again so far!
> ciao M. Baumann
> 
> On 20.08.2008 21:39, Paulo Soares psoares-at-consiste.pt |iText Mailinglist| 
> wrote:
>> You have to make the ColumnText wider than what you measured in the
>> Paragraph or the floating point rounding errors may cause the Paragraph to
>> wrap. An increase of 0.0001 points should be enough.
>>
>> Paulo
>>
>> ----- Original Message -----
>> From: <[EMAIL PROTECTED]>
>> To: <[email protected]>
>> Sent: Wednesday, August 20, 2008 8:20 PM
>> Subject: [iText-questions] unwanted wrapping / false width in ColumnText
>>
>>
>> Hello,
>>
>> I am experiencing a problem I haven't found so far:
>>
>> I'm adding a SimpleColumn (ColumnText) to the right side of the page at
>> absolute position. The right border is easy, just the full length of 210mm
>> (A4) minus the right margin.
>> But I'm having trouble with the left border-position (the Alignment in the
>> ColumnText is left).
>> To get this x-position I aquire the maximum width of the paragraphs in 
>> this
>> column (with the ColumnText.getWidth method), and simply substract this
>> float-value from the right border-position.
>>
>> This works ALMOST very good and I think it is the right approach. BUT:
>>
>> Even though I took the maximum Paragraph width for the column, the widest
>> Paragraph is still wrapped!
>> I have to make the column a "little bit" wider so it doesn't wrap. And 
>> this
>> "little bit" bothers me a lot, because it is different dependent on the
>> widest Paragraph.
>>
>> Why is this? This is really a weak point in my application, because the
>> content is dynamic, I can't just say "Oh well, I make the column wider by
>> 0.3 points", because for a wider paragraph that might not be enough and it
>> still wraps.
>>
>> Is there a way to determine this "extra space" in width which is obviously
>> needed so the longest Paragraph doesn't wrap?
>>
>> Thank you in advance, I really don't know how!
>>
>> Bye M. Baumann
>>
>> Code:
>> float rwidth=0;
>> Paragraph tel = new Paragraph(obj.getPhone(), FONT2);
>> Paragraph fax = new Paragraph(obj.getFax(), FONT2);
>> Paragraph email = new Paragraph(obj.getEmail(), FONT2);
>> if (ColumnText.getWidth(tel) > rwidth)
>>         rwidth = ColumnText.getWidth(tel);
>> if (ColumnText.getWidth(fax) > rwidth)
>>         rwidth = ColumnText.getWidth(fax);
>> if (ColumnText.getWidth(email) > rwidth)
>>         rwidth = ColumnText.getWidth(email);
>>
>> ColumnText ct2 = new ColumnText(cb);
>> ct2.setSimpleColumn(getPointsFromMM(210)-marginRight-rwidth-0.05f,
>>                 getPointsFromMM(207),
>>                 getPointsFromMM(210)-marginRight,
>>                 getPointsFromMM(252),
>>                 6.5f, Element.ALIGN_LEFT);
>> ct2.go();
>> ct2.addText(new Chunk("Tel: ", FONT2_BOLD));
>> ct2.go();
>> ct2.setLeading(leadingFont2);
>> ct2.addText(tel);
>> ct2.go();
>> ct2.setYLine(ct2.getYLine()-(leadingFont2/2));
>> ct2.addText(new Chunk("Fax: ", FONT2_BOLD));
>> ct2.go();
>> ct2.addText(fax);
>> ct2.go();
>> ct2.setYLine(ct2.getYLine()-(leadingFont2/2));
>> ct2.addText(new Chunk("E-Mail: ", FONT2_BOLD));
>> ct2.go();
>> ct2.addText(email);
>> ct2.go();

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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

Reply via email to