Formatting with ColumnText

View: New views
3 Messages — Rating Filter:   Alert me  

Formatting with ColumnText

by Vesselin Beltchev :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I need a little help on this issue. New  to iText and I just managed to get my pdf into working. The problem that I am having now is that I can't manage to set the font and the font-size properly.

Text showing and all, but it doesn't seem to considers this line

cb.setFontAndSize(ff ,10);

at all.

Any help would be deeply appreciated.

Greetings,
al

P.S. And the code:


        // Base Font
        BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
       
        // Text Font
        BaseFont ff = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
        int page = 2;
        stamper.insertPage(page, PageSize.A4);
       
        PdfContentByte cb = stamper.getOverContent(page);
       
        cb.setFontAndSize(ff ,10);
       
        ColumnText ct = new ColumnText(cb);
       
       
        ct.setSimpleColumn(new Phrase("Anhang zum Phytosanitären Transportdokument Nr.: EG/DE/" + dienststelleKuerzel
                + " " + antrag_id + "\n"), 36, 36, PageSize.A4.width() - 36, PageSize.A4.height() - 36, 10,
                Element.ALIGN_LEFT);
        ct.setSimpleColumn(new Phrase(
                "Besondere(s) Kennzeichen, Anzahl, Zahl der Packstücke, Menge (Gewicht/Einheiten)\n"), 36, 36,
                PageSize.A4.width() - 36, PageSize.A4.height() - 36, 18, Element.ALIGN_LEFT);
        ct.setSimpleColumn(new Phrase(kennZ.toString()), 36, 36, PageSize.A4.width() - 36, PageSize.A4.height() - 36,
                18, Element.ALIGN_LEFT);

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

Re: Formatting with ColumnText

by steve_c22 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Have not worked with ColumnText, but have you tried setting the font on the Phrase element instead?

Re: Formatting with ColumnText

by Vesselin Beltchev :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Steve,

thanks for your help. It worked perfectly.

Greetings,
al


2009/9/9 steve_c22 <mobettaut@...>

Have not worked with ColumnText, but have you tried setting the font on the
Phrase element instead?
--
View this message in context: http://www.nabble.com/Formatting-with-ColumnText-tp25347810p25368632.html
Sent from the itextsharp-questions mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions