If the encoding is UTF-8 then that's what we'll have to use. Do something
like this:

- read the file to a byte[] b with a FileInputStream.

String s = new String(b, "UTF8");
BaseFont bf = BaseFont.createFont("arialuni.ttf", BaseFont.IDENTITY_H,
BaseFont.EMBEDDED);
Paragraph p = new Paragraph(s, new Font(bf, 12));
document.add(p);

If this doesn't work then the encoding is not UTF-8.

Best Regards,
Paulo Soares

----- Original Message -----
From: "krishnakumar" <[EMAIL PROTECTED]>
To: "Paulo Soares" <[EMAIL PROTECTED]>
Sent: Thursday, August 22, 2002 5:46
Subject: Re: [iText-questions] issuse in PDF encoding for read thai char


> Hi,
> Here in thaidata.txt has the encoding as UTF-8,when i tried with all the
> encoding as Cp874 - IBM Thai
> ,MS874 - Windows Thai, TIS620 - TIS620, Thai.The output string data is not
> proper.Canu please give some more detail or example.
> With Best Regards,
> K.Krishna Kumar
> -----------------------
>
>
>
> ----- Original Message -----
> From: "Paulo Soares" <[EMAIL PROTECTED]>
> To: "krishnakumar" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Wednesday, August 21, 2002 8:03 PM
> Subject: Re: [iText-questions] issuse in PDF encoding for read thai char
>
>
> > There's nothing to look to. Your thaidata.txt has some encoding that you
> > must know. That encoding is the key to turn the txt into the unicode
> string
> > that java uses. Candidates are:
> >
> > Cp874 - IBM Thai
> > MS874 - Windows Thai
> > TIS620 - TIS620, Thai
> >
> >
> > After that step you'll have to use a TT font with encoding Identity-H.
> >
> > Best Regards,
> > Paulo Soares
> >
> > ----- Original Message -----
> > From: "krishnakumar" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, August 21, 2002 13:41
> > Subject: [iText-questions] issuse in PDF encoding for read thai char
> >
> >
> > > Hi,
> > > here im trying to read a thai charecters from a text file and creating
a
> > > pdf with iText.
> > > 1.thaidata.txt contains the original source file.
> > >   when i convert the bytes which i read from source text file into
> > > String using the PdfEncodings with different encoding like
> > > as Cp1252,PDF,"".it gerates the following outut file.all are not ok
with
> > > the source file content.
> > >
> > > 2.thaidata-Cp1252.txt
> > > 3.thaidata-PDF.txt
> > > 4.thaidata-null.txt
> > >
> > >     public static void getThaiFileData()
> > >     throws FileNotFoundException
> > >     {
> > >  try
> > >  {
> > >      FileInputStream fis = new FileInputStream(new
> > > File("c:\\temp\\thaidata.txt"));
> > >      System.out.println(fis.available());
> > >
> > >      byte[] b = new byte[4000];
> > >      fis.read( b);
> > >        FileOutputStream foss = new FileOutputStream(
> > > "c:\\temp\\thaidataPDF.txt");
> > >        PdfEncodings  pfd=new PdfEncodings();
> > >        line=pfd.convertToString(b,"");
> > >        foss.write(line.getBytes());
> > >  } catch(FileNotFoundException e)
> > >  {
> > >      throw e;
> > >  }
> > >  catch(IOException eio)
> > >  {
> > >      eio.printStackTrace();
> > >  }
> > >     }
> > >
> > >
> > >    Can you please look into it and help me.
> > >
> > > Thanks with best regards,
> > > K.Krishna Kumar
> > >



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to