Categories
Khmer Unicode

iText can render for Khmer Unicode

I just implement to put the render of Khmer Unicode in iText 5.5.4-SNAPSHOT and try, I could produce the PDF with the right display as following image.

iText is a core pdf writer in most of the opensource library for outputting report or rendering text but unfortunately, it’s not working with Khmer Unicode as I stated previously in my post.
itext-with-khmer-render-start

 

It’s just only the initial work and not yet done and sure that it’s fully working fine yet.

Remark: I have read: http://www.redlab.be/blog/2011/developer-guide/

And I have tried:

itext/src/main/java/com/itextpdf/text/pdf/TrueTypeFont.java
itext/src/main/java/com/itextpdf/text/pdf/languages/khmer
itext/src/main/java/com/itextpdf/text/pdf/languages/khmer/UnicodeRender.java
itext/src/main/java/com/itextpdf/text/pdf/languages/khmer/UnicodeUtil.java
itext/src/main/java/com/itextpdf/text/pdf/languages/KhmerLigaturizer.java

Update:

There won’t be an easy task to integrate the latest iText (5.x) version to some opensource product such as JasperReport to test Khmer render since they are still using very old version 2.1.7.

One more remark on iText product about its revolution since version 2.1.7, 4.2.0 to 5.x:

 

Source Code

30 replies on “iText can render for Khmer Unicode”

Its working fine but if there is any symbol which position is bottom of a letter(conjunct letter) doesn’t show.In that case it shows only a plus(+) sign bottom of that letter.Your attached image is a good example which has a plus symbol (2nd line, last character).How to resolve it? Thanks.

I can’t see it working. I have tried it with IText 5.5.6 but it does not work. Is this supported by iText now?

If I wanted to make a modified iText build (5.5.9-SNAPSHOT) that has Khmer support, how exactly would I integrate this code? It’s not entirely clear to me how you made it work.

@osify, When i try to print “Hello World សួស្តី​ពិភពលោក”(from Google translate) to PDF the the Hello World will be missing and the vowel below of first and second character seems to be right adjusted and the vowel below of second character become a cross.

Please see, my sample, to write:

KhmerLigaturizer d = new KhmerLigaturizer();
String strProcess = d.process(“ហេតុនេះ​យើង​ត្រូវ​តែរួម​គ្នា​ដោះ​ស្រាយ ខ្លួន ស្វាគមន៍មកកាន់អូស៊ីហ្វាយ”);

BaseFont bfComic = BaseFont.createFont(localFontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
document.add(new Paragraph(“Hello”));
document.add(new Paragraph(strProcess, new Font(bfComic, 22)));

Hi osify, if i input the string like “កាលបរិចេ្ឆទ/Date”, the Date will disappear in the pdf. can u help?

@osify, Thanks for your helpful support. It looks like I forgot to process the string before print. Actually, I’m helping my client who invested in Cambodia to print some PDF document in Khmer.

@osify , Can Khmer be supported in Jasper reports , because from your posts on the discussions it seems the issue is with the iText jar , so is there any possble way that I can use khmer in Jasper , if yes , please guide me for the same and thanks in advance the blogs are really helpful .

Hi Brother Osify,

Thank for your effort to make itext support khmer unicode but it’s .jar … can you make it to .dll I would like to add to Visual Studio 2017

Or i confused. I use iTextSharp to create PDF but the problem is iTextSharp version 5 does not support khmer unicode under script.
Do you have solution for .Net C# with iTextsharp to show khmer unicode correctly.

If not, i see iText7 support khmer language , does it fully support? Have you ever tried ?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.