krishnan.1000 wrote:
> Hi, 
> 
> I followed example Chapter7/ColumnControl.java to create a fax cover sheet
> for my project. I am trying to generate text which will be displayed on the
> new page without changing the font size. 

Am I right if I assume that you don't want the text to appear on
page 1 if it doesn't fit?

> In the uploaded pdf, the text is to be displayed under the Comments section.
> But no text is displayed. Can anyone please help?

The text isn't displayed because you forgot to reset the y coordinate.
This is wrong:

>     ct.addText(p);
>     int status = ct.go(true);
>     if (!ColumnText.hasMoreText(status)) {
>       ct.addText(p);
>       status = ct.go(false);
>       document.newPage();
>     } else {
>       document.newPage();
>       ct.setText(p);
>       ct.go();
>     }

It should be:

     ct.addText(p);
     float yLine = ct.getYLine();
     int status = ct.go(true);
     ct.setText(p);
     if (ColumnText.hasMoreText(status)) {
       document.newPage();
       yLine = 535;
     }
     ct.setYLine(yLine);
     status = ct.go();

Note that in this case, you aren't showing the complete comment String.
You might want to add the following lines:

     while (ColumnText.hasMoreText(status)) {
       document.newPage();
       ct.setYLine(535);
       status = ct.go();
     }
-- 
This answer is provided by 1T3XT BVBA

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to