That's a font issue, currently itext doesn't support Indic languages
(there's work in progress in this area). If it works somehow you got lucky.
Paulo
On Wed, Nov 12, 2014 at 9:52 AM, Jing F Fan <fjfj...@cn.ibm.com> wrote:
> Dear all,
> When we used iText to generate pdf containing the Thai characters on
> Window 7/2008, some characters can't display properly, while on windows
> 2003, everything works well.
>
> In windows 2003, the result is:
>
>
> while in windows 2008, the result is:
>
> Tahoma/Tahomabd used in my code is installed on both Win 2003 and 2008, *use
> the tahoma.ttf/tahomabd.ttf in windows 2003 replace the ones in win7/win
> 2008 could resolve the problem on win7/2008*.
>
> There is a discussion in which the issue is similar to mine, but I think
> the answer could not resolve my problem.
>
> http://itext-general.2136553.n4.nabble.com/Thai-characters-iText-support-td4658747.html
>
> Could you please help confirm it's an iText known issue/limitation or a
> bug of Windows? Thanks!
>
> Source code:
>
> *import* java.io.FileNotFoundException;
> *import* java.io.FileOutputStream;
> *import* java.io.IOException;
> *import* com.itextpdf.text.Document;
> *import* com.itextpdf.text.DocumentException;
> *import* com.itextpdf.text.Font;
> *import* com.itextpdf.text.FontFactory;
> *import* com.itextpdf.text.Phrase;
> *import* com.itextpdf.text.Rectangle;
> *import* com.itextpdf.text.pdf.BaseFont;
> *import* com.itextpdf.text.pdf.ColumnText;
> *import* com.itextpdf.text.pdf.PdfContentByte;
> *import* com.itextpdf.text.pdf.PdfWriter;
>
> *public* *class* TestThai {
> *public* *static* *final* String *RESULT* = "Testthai.pdf";
> *public* *static* *final* String *FRAGMENT* = "ครั้งที่";
>
>
> *public* *static* *void* main(String[] args) {
> *float* pageWidth = 596.0f;
> *float* pageHeight = 842.0f;
> Rectangle rect = *new* Rectangle(pageWidth, pageHeight);
> Document doc = *new* Document(rect, 0, 0, 0, 0);
> FileOutputStream out = *null*;
> PdfWriter pdfWriter = *null*;
> *try* {
>
> FontFactory.*registerDirectories*();
>
> out = *new* FileOutputStream(*RESULT*);
> pdfWriter = PdfWriter.*getInstance*(doc, out);
> doc.open();
>
> Font pdfFont = FontFactory.*getFont*("Tahoma", BaseFont.*IDENTITY_H*,
> *false*, 22.0f);
> PdfContentByte pdfContentByte = pdfWriter.getDirectContent();
>
> *float* px = 70.0f;
> *float* py = 80.0f;
> *float* baselineOffsets = 18.0f;
> *float* baseline = py + baselineOffsets;
>
> *int* runDirection = PdfWriter.*RUN_DIRECTION_LTR*;
> Phrase phrase = *new* Phrase(*FRAGMENT*, pdfFont);
> *int* alignMethod = PdfContentByte.*ALIGN_LEFT*;
>
> ColumnText.*showTextAligned*(pdfContentByte, alignMethod, phrase, px,
> doc.top(baseline), 0f, runDirection, 0);
>
> } *catch* (FileNotFoundException e) {
> e.printStackTrace();
> } *catch* (DocumentException e) {
> e.printStackTrace();
> }
> *finally* {
> *if* (doc != *null*) {
> doc.close();
> }
> *if* (out != *null*) {
> *try* {
> out.close();
> } *catch* (IOException e) {
> e.printStackTrace();
> }
> }
> *if* (pdfWriter != *null*) {
> }
> }
>
> }
>
> }
>
>
> Best Regards,
> Jing Fan
> Email: fjfj...@cn.ibm.com
>
>
> ------------------------------------------------------------------------------
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push notifications.
> Take corrective actions from your mobile device.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples:
> http://itextpdf.com/themes/keywords.php
>
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php