Write hebrew text to pdf using itextpdf

855 views Asked by At

I'm trying to write Hebrew characters to a PDF.

I created HTML in the servlet by appending to a string buffer.

Then passing the same to xmlworkerhelper.

Also registered the arial.ttf, arialuni.ttf and arialbold.ttf fonts using XMLWorkerFontProvider and using the registered fonts in xmlworkerhelper.

Used the below fonts for registering arial.ttf, ArialBold.ttf, arialuni.ttf;

Any solutions for this issue will be very helpful. Let me know if more details required.

Below is the snippet.

XMLWorkerFontProvider fontImp = new XMLWorkerFontProvider();
fontImp.register(arial);
fontImp.register(arialbold);
fontImp.register(arialuni);
byte[] byte6=PDFtext.toString().getBytes("ISO-8859-1");
String bufferfinalPDF=new String(byte6, "UTF-8");
XMLWorkerHelper.getInstance().parseXHtml(writer, document, new ByteArrayInputStream(bufferfinalPDF.getBytes(Charset.forName(baseFont))),null,Charset.forName(baseFont),fontImp);

Solution or a suggestion on this is very helpful.

0

There are 0 answers