Forums Register Login

Currency Symbol Issue in iText

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
Get me the mayor's office! I need to tell him about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 4029 times.
Similar Threads
Identifiers
JSTL fmt:formatNumber does not display currency
Embedding Currency Sumbol
Output Formatting
Unable to display Japanese Currency 'YEN' in pdf using iText 3.0
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 00:47:41.