How to add pdf currency symbols created by my application?

I want to add currency symbols to a pdf report created by my Android application. String characters that I add to the file ... but are not displayed. Is there a solution? Do I need to use any fonts or encoding for this?

+5
source share
1 answer

If you need to use only a few currency signs, you can use the walk for some characters, for example, for the Euro sign in PDF format using the built-in Helvetica pdf font with code page 1252:

BaseFont helvetica = BaseFont.createFont("Helvetica", BaseFont.CP1252, BaseFont.NOT_EMBEDDED); Font font = new Font(helvetica, 12, Font.NORMAL); Chunk chunk = new Chunk("Euro symbol: 20\u20ac.", font); document.add(chunk); 

But if you want to support all currency symbols, then you should use a font with unicode support (for example, Arial Unicode MS) and paste it into the output PDF. A complete list of Unicode currency symbols can be found at unicode.org .

0
source

Source: https://habr.com/ru/post/1207874/


All Articles