Search code examples
javapdfitextpdf-writer

I can't add the ₺ (Turkish Lira) icon to the file with Java PDFWriter


BaseFont bfSpecial = BaseFont.createFont("get_font/verdana.ttf",BaseFont.IDENTITY_H, BaseFont.EMBEDDED);

Font my_font = new Font(bfSpecial, 9, Font.BOLD, BaseColor.BLACK);
    
document.add(new Paragraph("\n",my_font));
document.add(new Paragraph("*(₺₺₺₺₺)*",my_font));
document.add(new Paragraph("\n",my_font));

My Output
image

How to View the ₺ (Turkish Lira) sign on PDF?


Solution

  • I finally solved the problem. I just had to use the font "DejaVuSerif.ttf" for the solution. you can download the font here

    BaseFont bfSpecial = BaseFont.createFont("get_font/DejaVuSerif.ttf",BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
    Font font = new Font(bfSpecial, 9, Font.NORMAL, BaseColor.BLACK);