Hi. I've just subscribed, and have no idea of the prevailing 
nettiquette here, but am pressed for time. I have an issue with iText 
version 2.0.8 running on the Sun JVM 1.5.0_14 and 1.6.0-b105 on Debian 
etch. Please forgive me if I break any of the local rules, and let me 
know if I missed a crucial bit of info that should always be provided 
with a question. I did try the list archives, but did not find anything 
relevant.

I'm trying to change the font in a cell in a PdfPTable, and I'm seeing 
odd behavior. I'm trying to switch from bold to normal Helvetica, but 
the text all renders as bold. If I switch the order in which the text 
appears, normal first, then bold, it works as expected. I've reproduced 
the issue in the 50 lines of code below, with both a row that changes 
from normal to bold and one that doesn't change from bold to normal.

I'm also attaching the resulting pdf, but am unsure if it will come 
through unscathed. 

If anyone could tell me what I'm doing wrong, I'd really appreciate it. 
Having been a professional software developer for over 20 years now, my 
instincts tell me that this is a bug in the library, but I don't have 
enough time working with the library to know if I've done something 
daft.

Thank you,
        -Greg

--------------------8<-----------------------------------
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.PageSize;
import com.lowagie.text.Phrase;
import com.lowagie.text.Font;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfWriter;

import java.io.IOException;

/**
 * 
 */
public class BugReport {

    public BugReport() {

        Document document = new Document(PageSize.LETTER.rotate(), 20, 
20, 20, 20);
        try {
            PdfWriter.getInstance(document,
                    new FileOutputStream("BugReport.pdf"));
            document.open();

            Font fHead = new Font(Font.HELVETICA, 8, Font.BOLD);
            Font fBody = new Font(Font.HELVETICA, 8, Font.NORMAL);

            PdfPTable tHead = new PdfPTable(1);
            Phrase pLabel = new Phrase("This should be BOLD. ", fHead);
            pLabel.add(new Phrase("This should be NORMAL. ", fBody));
            tHead.addCell(pLabel);
            Phrase pLabel2 = new Phrase("This should be NORMAL. ", 
fBody);
            pLabel2.add(new Phrase("This should be BOLD. ", fHead));
            tHead.addCell(pLabel2);

            document.add(tHead);
            document.close();
        } catch (Exception de) {
            de.printStackTrace();
        }
        document.close();
    }

    public static void main(String[] args) {
        BugReport ptc = new BugReport();
    }
}
--------------------8<-----------------------------------
-- 
Gregory H. Vilardi    631-752-2701x240     [EMAIL PROTECTED]
Project Manager / Lead Software Engineer           
Recurrent Software Solutions, a division of PES Payroll 
1 Huntington Quadrangle, Suite 1C02, Melville, NY 11747 
Fax: 631-752-3397                                 
http://www.recurrentsoft.com


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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