Priya Mandawat wrote:
> I need to create pdf files in different languages (depending on the 
> user's locale). I looked around to see how it's done and I see the following

If you create a PDF using iText's high level classes (Paragraph,
PdfPTable, ColumnText,...), you'll need instances of the font class
com.itextpdf.text.Font and you'll have to look at:

> 1. examples using the FontSelector class, inserting fonts in the 
> appropriate order and then processing the text to be rendered against it.

If you create a PDF using Java's Graphics2D (using drawString()), you
need instances of the font class java.awt.Font and you should look at:

> 2. examples using the FontMapper/DefaultFontMapper to provide the pdf 
> font for a given awt font.
> 
> My question is: What is the difference between the 2 approaches, or when 
> should either be used over the other?

You should prefer 1.
Because if you use 2., you'll have to take many different things into
account (this is explained in chapter 14 of the second edition of iText
in Action, but this chapter isn't available yet). As a newbie, it will
be hard to understand all the issues you can encounter with Graphics2D
if you don't have any documentation.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Download Intel® 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