• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Currency Symbol Issue in iText

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 26626
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic