I've just upgraded to version 1.3 from 1.01 of iText. Running my
existing application, I found I got the stack trace:

java.lang.NullPointerException
at com.lowagie.text.pdf.ColumnText.findLimitsPoint(ColumnText.java:477)
at com.lowagie.text.pdf.ColumnText.findLimitsOneLine(ColumnText.java:493)
at com.lowagie.text.pdf.ColumnText.findLimitsTwoLines(ColumnText.java:514)
at com.lowagie.text.pdf.ColumnText.go(ColumnText.java:823)
at com.lowagie.text.pdf.ColumnText.go(ColumnText.java:721)
[snip]

After running through a debugger I discovered that rightWall and leftWall were always null, and hence the NPE.

Comparing ColumnText from 1.01 and 1.3 I noticed that in the method setSimpleColumn() in 1.01 calls the method setColumns() is called which performs the assignment to rightWall and leftWall. This call is missing in 1.3. I've added the call back in and tested with my setup and it solves the exception for me.

Below is my revised method, which starts at line 573 in ColumnText.java:

public void setSimpleColumn(float llx, float lly, float urx, float ury,
                            float leading, int alignment)
{
  setLeading(leading);
  this.alignment = alignment;
  setSimpleColumn(llx, lly, urx, ury);
  float leftLine[] = new float[]{leftX, maxY, leftX, minY};
  float rightLine[] = new float[]{rightX, maxY, rightX, minY};
  setColumns(leftLine, rightLine);
}


Hope this helps! Thanks.

--
Mike Fowler
Registered Linux user: 379787

"I could be a genius if I just put my mind to it, and I,
I could do anything, if only I could get 'round to it"


------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to