Hi Paulo,
many thanks for the fix in SVN. How can I get the jar with the fix included ? I 
am currently using itext-2.1.7. When do you plan to post the next official jar 
which includes the fix ?
Regards,

Martin

-------
It was a bug. It's fixed in the SVN.

Paulo
----- Ursprüngliche Mail -----
Von: martin weiss <martin.we...@mw-informatik.ch>
An: itext-questions@lists.sourceforge.net
Gesendet: Fri, 26 Feb 2010 10:12:19 +0100 (CET)
Betreff: Has fix row height implementation [PdfPCell.setFixedHeight()] a bug ?

Hi Paulo
sorry, if I come back. The sample below gives me the impression that the fix 
row height implementation has a bug. I would appreciate if you could prove my 
assumption. We should go in production with the application and the strange 
behavior makes me a little bit nervous...
Many thanks for your support
Martin

Result of System.out.println: height for row 0: 19.4 [I expect 16 => 
setFixedHeight()]

package ch.mwi.itext;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPRow;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;

public class FixedRowHeight {

        public static void main(String[] args) {

                Document document = new Document();
                try {
                        PdfWriter.getInstance(document, new FileOutputStream(
                                        
"/results/in_action/chapter02/FixedRowHeight.pdf"));
                        document.open();
                        PdfPTable itextTable = new PdfPTable(1);
                        try {
                                float[] columnWidths = new float[] { 25 };
                                itextTable.setTotalWidth(columnWidths);
                        } catch (DocumentException documentException) {
                                /* TODO */
                                documentException.printStackTrace();
                        }
                        itextTable.setLockedWidth(true);
                        itextTable.setHorizontalAlignment(Element.ALIGN_LEFT);
                        Font font = FontFactory.getFont(FontFactory.HELVETICA, 
8,
                                        Font.NORMAL);
                        Phrase phrase = new Phrase("44630259", font);
                        PdfPCell itextCell = new PdfPCell(phrase);
                        itextCell.setFixedHeight(16);
                        itextCell.setHorizontalAlignment(Element.ALIGN_LEFT);
                        itextCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        itextCell.setPaddingLeft(2);
                        itextCell.setPaddingRight(2);
                        itextCell.setPaddingTop(2);
                        itextCell.setPaddingBottom(2);
                        itextCell.setUseAscender(true);
                        itextCell.setUseDescender(true);
                        itextCell.setNoWrap(false);
                        itextTable.addCell(itextCell);
                        document.add(itextTable);
                        List<PdfPRow> rowList = itextTable.getRows();
                        int rowIndex = 0;
                        for (PdfPRow row : rowList) {
                                System.out.println("height for row " + rowIndex 
+ ": "
                                                + 
itextTable.getRowHeight(rowIndex));
                                rowIndex++;
                        }
                } catch (DocumentException de) {
                        System.err.println(de.getMessage());
                } catch (IOException ioe) {
                        System.err.println(ioe.getMessage());
                }
                document.close();
        }
}


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to