First a remark, I'm not sure how your mail was written, but
it was very hard to read in my mail client. The first line
had a normal font, but starting with the code sample, the
font was so small that it almost became illegible.

firefox_zyw wrote:
> how can I put multiple texts which have different formats(like bold, 
> fontsize,color,etc) in one line?

Font size and font color are easy: class Font has methods
setSize and setColor. Bold and italic are more difficult,
but not impossible.

The code sample you used contains references to a film
that was very popular in Israel. I recognize some of the
code lines from the book 'iText in Action'.

Therefore I assume that you own the book, which makes it
easy for me to answer your question.

As you can read in chapters 8 and 9 of the book, you
have the concept of a 'font family' (for instance Arial),
and within this family you have different 'fonts', for
instance: Arial, Arial Bold, Arial Italic,...

Essentially if you want to have 'normal text' and 'bold text',
you'd need to use two different fonts: one with the normal
glyphs and one with the bold glyphs.

BaseFont bf1 = BaseFont.createFont("c:/windows/fonts/arial.ttf",
                     BaseFont.IDENTITY_H, true);
BaseFont bf2 = BaseFont.createFont("c:/windows/fonts/arialbd.ttf",
                     BaseFont.IDENTITY_H, true);

You put the normal text in phrases that are created with
a font using bf1; and the bold text in phrases created
with a font using bf2.

Unfortunately, some fonts only have normal glyphs. If you
have a font.ttf, it's not always possible to find a fontbd.ttf.
In that case, you need to have a look at sections 4.3.4 and
4.3.6 that describe how to simulate italic and bold for these
font.

Actually, that was how the following PDF file was created:
http://itext.ugent.be/itext-in-action/examples/chapter09/results/say_peace.pdf
-- 
This answer is provided by 1T3XT BVBA

-------------------------------------------------------------------------
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