I am using iText to create pdf in Java and want to add currency symbol to it. I have both ISO 3 digit currency code and Unicode for each respective symbols. Condition is: Only one currency symbol will be added at a time. I have done some work in this direction but I need some better and quick solution.
: MY Work :
For example if I want to add ₹ symbol for INR. I need the font file that supports ₹ symbol
String currency = "INR"; //Will be provided but will be dynamic
public String FONT = "resources/fonts/FreeSans.ttf"; //should be selected dynamically depending upon the currency language
I have Embedded the font file in my code
Font f = FontFactory.getFont(FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(dest)); //dest is the destination of file
document.open();
String currencyUnicode = "\u20B9"; //Here unicode will come dynamically depending on currency code
Paragraph currencySymbol = new Paragraph(currencyUnicode, f);
document.add(currencySymbol); //This will add ₹ to pdf
I have read few similar type of questions with their solutions, but there currency symbol is static and I want to support all currency symbols dynamically.