You just need:

ColumnText ct = new ColumnText(null);
ct.setSimpleColumn(LEFT_MESSAGE_LOWER_X, LEFT_MESSAGE_LOWER_Y,
LEFT_MESSAGE_UPPER_X,
 LEFT_MESSAGE_UPPER_Y, MESSAGE_PADDING, MESSAGE_ALIGNMENT);
ct.addText(new Phrase(“Text to enter”,FONT));

if (ColumnText.NO_MORE_TEXT  !=ct.go(true)) {
  “TOO MUCH TEXT”

Paulo

----- Original Message ----- 
From: "david allen" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, April 27, 2007 6:50 AM
Subject: [iText-questions] Usage of ColumnText Object


>
> Hi All,
>
> I have a web app that allows a user to enter text into a html text area. 
> The
> text they enter into the text area is used to generate a pdf file. One
> requirement is that there is a limit on the amount of text entered.
> After they enter their text and hit submit the a pdf file is created and 
> it
> is at this stage that we know if they have entered too much text. I am 
> using
> the class ColumnText and the method  ct.go to determine of there was any
> text that did not fit into the ColumnText object.
>
> We would like to provide some real time validation using ajax. After each
> word is entered we go off to the server and validate the text entered and
> inform the user before they hit the submit button. I am want to know what
> would be the least expensive way of doing this using Itext.
>
> Is there a lot of over head in creating the following objects. Does anyone
> know of a less expensive way of doing it
>
> Document document = new Document(new
> Rectangle(HORIZONTAL_PICTURE_PAGE_WIDTH, HORIZONTAL_PICTURE_PAGE_HEIGHT));
> document.setMargins(0, 0, 0, 0);
> pdfWriter = PdfWriter.getInstance(document, out);
> document.open();
> ………………..
> ColumnText ct = new ColumnText(pdfContentByte);
> ct.setSimpleColumn(LEFT_MESSAGE_LOWER_X, LEFT_MESSAGE_LOWER_Y,
> LEFT_MESSAGE_UPPER_X,
>   LEFT_MESSAGE_UPPER_Y, MESSAGE_PADDING, MESSAGE_ALIGNMENT);
> ct.addText(new Phrase(“Text to enter”,FONT));
>
> if (ColumnText.NO_MORE_TEXT  !=ct.go()) {
> “TOO MUCH TEXT”


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to