Well, I have some records in my database and one of those have a character Đ wich is croatian.
The record in the database is correct and when I display it in a grid in JSF/Primefaces
the character is diplayed perfectly.
But, when I print it in a PDF
using iText
the Đ
is missing.
I red a lot of manuals including "iText in Action 2nd edition" and try every tip but nothing works.
The manual says that if you put writer.getAcroForm().setNeedAppearances(true); the system will try to render the "image" of the character but it doesnt work.
So far I am tryng with another aproach, I downloaded a Croatian ttf file and this is my current status
BaseFont CROACIA =BaseFont.createFont("C:\\CroatiaHrvatska.ttf",BaseFont.WINANSI, BaseFont.EMBEDDED);
CROATA = new Font(CROACIA, 12);
Document documento = new Document();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(documento, baos);
writer.setInitialLeading(20);
documento.open();
String frase ="Đaniel";
documento.add(new Paragraph(frase, CROATA));
Then I close the document and dowload it as PDF
, it works but the Đ
is still gone (so are most of the text to).
I tried using ISO-8859-1
and UTF-8
as characters as some people suggested in other questions at SO but it doesnt work.