File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Currency Symbol Issue in iText Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Currency Symbol Issue in iText" Watch "Currency Symbol Issue in iText" New topic
Author

Currency Symbol Issue in iText

Joshi Sujit
Greenhorn

Joined: Jul 29, 2010
Posts: 6
Hi All,

I am using iText 5.1.2 library to generate the dynamic report in PDF format. I have a requirement to display some of the currency symbols in PDF.
We are using unicode decimals to display these symbols.
Below is the details of currency's,
Currency-----Unicode decimal-----Unicode hex value
==================================
YEN-----------165--------------------00a5
Dollar-------- 36---------------------0024
Euro----------8364-------------------20ac
Pound--------163---------------------00a3
Peso----------8369--------------------20b1

iText is not displaying currency symbol for the currency YEN and Peso if i use unicode decimal.
But if i use unicode hex value for YEN and Peso, iText is able to display YEN currency properly but failing to display for Peso.

Does some one know how to solve this issue?

Thanks,
Sujit Joshi
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

It would help to know what "using unicode decimals" actually meant. To me the simple and obvious way to deal with those characters would be to simply put them in ordinary Java strings. Apparently you have been doing something different. It isn't going to be possible to answer your question without knowing what that was.
Joshi Sujit
Greenhorn

Joined: Jul 29, 2010
Posts: 6
Hi Paul,

We are receiving the decimal code of the currency from our backend logic and we are converting this into UTF8 format using iText function as below,
String currency = com.itextpdf.text.Utilities.convertFromUtf32(8369);

and we add this currency into PDF as below,
table.addCell(new Paragraph(currency, amtValueFont));

here, amtValueFont is using FontFactory.getFont(BaseFont.HELVETICA, 50, Font.BOLD, BaseColor.BLACK);
This above logic does not seem to work in PDF generated for both YEN and PESO currency symbols. Hence I have tried passing the hex code of the currency as below,

String currency = "\u20B1";
table.addCell(new Paragraph(currency, amtValueFont));

This new logic is working for YEN but not working for PESO.

I have also tried with sample java code to display PESO using hexcode, but the console display ? instead of actual symbol.

I hope this is more clear, please let me know how to resolve this.
Joshi Sujit
Greenhorn

Joined: Jul 29, 2010
Posts: 6
Hello,

I am stuck in this issue for long time and i need an urgent help for this, could any one suggest me for the approach/solution?

Thanks,
Sujit Joshi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Currency Symbol Issue in iText