Hey guys,

I believe there's a bug in the way that the PdfPTable computes it's header heights in the jdk15 branch (I haven't confirmed that it exists in other branches). Instead of reading only the header rows to compute the height, it was reading all the rows and suming their heights.

It was causing problems for me in an application that I'm writing so I just made the change to my local copy and things seems to be working correctly now.

I am perhaps vastly misunderstanding the code, but the change seems to be correct to me. I'm not clear on how to submit a patch, nothing on the website has any info, so I thought I'd try the mailing list.

Please see attached for the patch.

Thanks,

Sam Gibson
Index: core/com/lowagie/text/pdf/PdfPTable.java
===================================================================
--- core/com/lowagie/text/pdf/PdfPTable.java    (revision 3872)
+++ core/com/lowagie/text/pdf/PdfPTable.java    (working copy)
@@ -756,7 +756,9 @@
     public float getHeaderHeight() {
         float total = 0;
         int size = Math.min(rows.size(), headerRows);
-        for (PdfPRow row: rows) {
+        for (int k = 0; k < size; ++k)
+        {
+            PdfPRow row = rows.get(k);
             if (row != null)
                 total += row.getMaxHeights();
         }
@@ -1306,4 +1308,4 @@
        public void setComplete(boolean complete) {
                this.complete = complete;
        }
-}
\ No newline at end of file
+}
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
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