Question on setting font size in whole document

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

Question on setting font size in whole document

by LgM Michael :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a very simple document that currently has a single table into  
which I add cells.

document.open();
PdfTable table = new PdfTable(5);
table.addCell(... and so on

I would like to change the font size to be smaller throughout the  
document, as well as add an introductory paragraph, and size the cells  
differently (the first 4 cells can be smaller with the last cell  
needing room for the most text).

Can anyone point me to how to approach this?

Thank you
Mike

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@...
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/

Re: Question on setting font size in whole document

by Mark Storer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://itextdocs.lowagie.com/tutorial/
There's also the "iText in Action" book.

More specifically, there isn't some global "default font size" attribute you can change.  You just have to specify a given size when you set the font.

The basic "Chunks" example probably uses the same constructor you do to add text:
http://itextdocs.lowagie.com/examples/com/lowagie/examples/objects/Chunks.java

Chunk foo = new Chunk("My String.");
paragraph.add( foo );

There's another constructor:

Font myFont = new Font( Font.TIMES_ROMAN, 8 ); // name & point size
Cunk bar = new Chunk("My String, only different.", myFont );
paragraph.add( bar );
document.add( parargraph );
document.close();

Without a particular font defined, iText will use a default, which I believe is Times 12pt, but I could be wrong.

I stronly suspect that any method given to add text to a Document will have an override that allows you to define a font for that text.


--Mark Storer
  Senior Software Engineer
  Cardiff.com

#include <disclaimer>
typedef std::Disclaimer<Cardiff> DisCard;



> -----Original Message-----
> From: LgM Michael [mailto:dev1@...]
> Sent: Monday, October 26, 2009 2:31 PM
> To: itext-questions@...
> Subject: [iText-questions] Question on setting font size in whole
> document
>
>
> I have a very simple document that currently has a single table into  
> which I add cells.
>
> document.open();
> PdfTable table = new PdfTable(5);
> table.addCell(... and so on
>
> I would like to change the font size to be smaller throughout the  
> document, as well as add an introductory paragraph, and size
> the cells  
> differently (the first 4 cells can be smaller with the last cell  
> needing room for the most text).
>
> Can anyone point me to how to approach this?
>
> Thank you
> Mike
>
> --------------------------------------------------------------
> ----------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year.
> Jumpstart your
> developing skills, take BlackBerry mobile applications to
> market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> iText-questions mailing list
> iText-questions@...
> 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/


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@...
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/