1

I'm creating an XHTML that contains greek characters. Find a simple example below.

XHMTL= "ΚΑΛΗμέρα"
ITextRenderer renderer = new ITextRenderer();
renderer.getFontResolver().addFont("fonts/verdana.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
renderer.setDocumentFromString(XHTML);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                try {
                    renderer.createPDF(baos);

                } catch (DocumentException e) {
                    jObj.put("status", 0);
                    jObj.put("error", "Could not create the file");
                    return jObj.toString();
                }

When I'm printing the result I'm getting ???????α.

Any help please?

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
zinon
  • 4,427
  • 14
  • 70
  • 112

1 Answers1

1

I found the solution. I've changed the fonts and upload them on the server:

ITextRenderer renderer = new ITextRenderer();
                    renderer.getFontResolver().addFont("/mypath/fonts/ARIALUNI.TTF",BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
                                
renderer.setDocumentFromString(XHTMLstring);
zinon
  • 4,427
  • 14
  • 70
  • 112