Unicode characters in iText PDF

You need a unicode font. Here is an example:

BaseFont bf = BaseFont.createFont("arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);

Paragraph p = new Paragraph("Şinasi ıssız ile ağaç", new Font(bf, 22));

document.add(p);

http://abdullahakay.blogspot.com/2011/11/java-itext-unicode.html

EDIT:

Here, the font file name arialuni.tff is a static resource directly under /src/main/resources/ and can be any Unicode Font File of your choice. Here's a list of free Unicode Font Files available online.


It depends on used font and encoding. i found something like this:

http://itext-general.2136553.n4.nabble.com/Polish-National-Characters-are-not-getting-displayed-in-the-PDF-created-by-iTExt-td2163833.html

There is example like this:

BaseFont bf = BaseFont.createFont("c:/windows/fonts/arial.ttf", 
BaseFont.CP1250, BaseFont.EMBEDDED); 
Font font = new Font(bf, 12); 
String polish = "\u0104\u0105\u0106\u0107\u0118\u0119"; 
document.add(new Paragraph(polish, font)); 

Remember that some fonts does not contain polish national characters.


In case you are using com.itextpdf.kernel package you can use any encoding which is not present in PdfEncodings class

PdfWriter writer ;
writer = new PdfWriter( dest ) ;
PdfDocument pdf = new PdfDocument( writer ) ;

Document document = new Document( pdf ) ;

FontProgram fontProgram = FontProgramFactory.createFont( ) ;
PdfFont font = PdfFontFactory.createFont( fontProgram, "Cp1254" ) ;
document.setFont( font );

for turkish characters I used "Cp1254"