Hi Paulo,
I wrote the following code to do this.
float[] position = form.getFieldPositions(name);
float[] left = {position[1], position[2], position[3], position[2]};
float[] right = {position[1], position[4], position[3], position[4]};
float[] left = {position[1], position[2], position[3], position[2]};
float[] right = {position[1], position[4], position[3], position[4]};
PdfWriter writer = stamper.getWriter();
ColumnText text = new ColumnText(writer.getDirectContent());
text.setColumns(left, right);
text.addText(new Phrase(value));
if (text.go(true) == ColumnText.NO_MORE_COLUMN)
System.out.println("overflow");
ColumnText text = new ColumnText(writer.getDirectContent());
text.setColumns(left, right);
text.addText(new Phrase(value));
if (text.go(true) == ColumnText.NO_MORE_COLUMN)
System.out.println("overflow");
I get the following exception:
java.lang.RuntimeException: No valid column line found.
at com.lowagie.text.pdf.ColumnText.convertColumn(Unknown Source)
at com.lowagie.text.pdf.ColumnText.setColumns(Unknown Source)
I am just trying to simulate the creation of a coulmn same size as that of the text field and see whether the data fits into it.
I have no idea what I am doing wrong.
Another question : what is 'leading' in the method setSimpleColumn()? Javadoc does not say anything.
Thank you very much for your time.
Merlyn.
Paulo Soares <[EMAIL PROTECTED]> wrote:
You have iText examples in the main site and in itextpdf.sf.net. See AcroFields.getFieldPositions() and the javadocs for ColumnText.Best Regards,Paulo Soares
From: Merlyn Mathias [mailto:[EMAIL PROTECTED]
Sent: Friday, September 24, 2004 2:49 AM
To: Paulo Soares; [EMAIL PROTECTED]
Subject: Re: [iText-questions] Text OverflowHi,Thank you so much for the reply. I am new to itext and I could not find it on the web. It would be very helpful if you could send me an example of how to get the field dimensions from pdfstamper object and to use columntext.Thanks againMerlyn.
Paulo Soares <[EMAIL PROTECTED]> wrote:You can get the field dimensions and use ColumnText to see if the text fits.
Best Regards,
Paulo Soares
----- Original Message -----
From: "Merlyn Mathias" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 23, 2004 20:52
Subject: [iText-questions] Text Overflow
> Hi,
>
> I have a multiple line text field in my PDF. The application reads the pdf
and
> using PdfStamper, the data gets populated in the fields. I want to check
> whether the data fits into the field, if not I want to take the entire
text to
> the end of the document. How do I detect overflow using pdfstamper?
>
> Thank you.
> Merlyn.
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> Project Admins to receive an Apple iPod Mini FREE for your judgement on
> who ports your project to Linux PPC the best. Sponsored by IBM.
> Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!