Hi all,

A little bit more explanation about the problem I have with some Asian 
characters:

I want to display the following Asian characters:
Unicode:                \u670D\u52A1\u5185\u5BB9
Asian Characters:       服务内容

Library’s which I am using:
- iTextAsianCmaps.jar (only after your feedback)
- itext-2.0.1.jar

Java Code I am using:

BaseFont bfGill = BaseFont.createFont(“MSung-Light”, “UniCNS-UCS2-H”, 
BaseFont.NOT_EMBEDDED);
Font bfGillFont7 = new Font(bfGill, 7, Font.NORMAL);
Paragraph p = new Paragraph(“\u670D\u52A1\u5185\u5BB9”, bfGillFont7);
document.add(p);

Display in PDF document:
服務􅆅容 (􅆅 is space)

After feedback:

BaseFont bfGill = BaseFont.createFont(“MSung-Light”, “UniCNS-UCS2-H”, 
BaseFont.NOT_EMBEDDED);
Font bfGillFont7 = new Font(bfGill, 7, Font.NORMAL);
Paragraph p = new Paragraph(convertText(“\u670D\u52A1\u5185\u5BB9”), 
bfGillFont7);
document.add(p);

/**
*method convertZHtext to convert the unknown characters for Taiwan
*/
private String convertText(String text){
  String returnString = text;
  PdfEncodings.loadCmap("GBK2K-H", PdfEncodings.CRLF_CID_NEWLINE);
  byte textBytes[] = returnString.getBytes();
  returnString = PdfEncodings.convertCmap("GBK2K-H", textBytes);
  return returnString;
}

Display in PDF document:
    (4 spaces)


I need one of the CNS encodings but I don’t know where I can find a list of 
the CNS encodings. I think this is the problem why it is not displaying my 
data with the change Bruno recommended. I hope someone can help me with this 
problem.

Thanks in advance and very kind regards,
Bart Elshout

>From: "Paulo Soares" <[EMAIL PROTECTED]>
>Reply-To: Post all your questions about iText here 
><itext-questions@lists.sourceforge.net>
>To: "Post all your questions about iText here" 
><itext-questions@lists.sourceforge.net>
>Subject: Re: [iText-questions] (no subject)
>Date: Tue, 10 Apr 2007 15:05:17 +0100
>
>What you are experiencing can also happen with other CJK languages. You
>are in one of these situations:
>
>1 - The character is in the Unicode basic plane (0000-ffff) but the
>glyph doesn't exist in the font. You'll have to get another font.
>
>2 -The character is not in the basic plane and need 32 bit to be
>described. iTextAsian.jar won't work, you'll need iTextAsianCmaps.jar.
>
>This is described in page 252 of the book "iText in Action" but I'll
>paste a small example.
>
>PdfEncodings.loadCmap("GBK2K-H", PdfEncodings.CRLF_CID_NEWLINE);
>byte text[] = my_GB_encoded_text;
>String cid = PdfEncodings.convertCmap("GBK2K-H", text);
>BaseFont bf = BaseFont.createFont("STSong-Light", BaseFont.IDENTITY_H,
>BaseFont.NOT_EMBEDDED);
>Paragraph p = new Paragraph(cid, new Font(bf, 14));
>document.add(p);
>
>In your case the cmap would be one of the CNS encodings.
>
>Paulo
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of Bart Elshout
> > Sent: Tuesday, April 10, 2007 1:49 PM
> > To: itext-questions@lists.sourceforge.net
> > Subject: [iText-questions] (no subject)
> >
> > Hi all,
> >
> > I have a question about the support of Asian Characters.
> >
> > We are generating PDF reports via Java-sevlets. We are using the
> > iTextAsian.jar to use the different Asian fonts.
> >
> > Everything is displayed ok, but some of the characters are
> > not displayed. We
> > are reading labels from files in different languages. The
> > only one which has
> > bugs so far as I can read is the Traditional Chinese translation file
> > (Taiwan).
> >
> > The bug is some missing characters. We are reading the
> > unicodes from the
> > files and some unicodes are skipped and displayed in the PDF
> > as space. When
> > I test them in the normal (not Itext/PDF) part of our application the
> > unicodes are all translated also the ones which are not
> > working in the
> > Itext/PDF part.
> >
> > Does someone have experience with such kind of problems or
> > with reports in
> > Traditional Chinese (Taiwan)? I hope someone can help me with
> > this problem.
> >
> > Thanks in advance and kind regards,
> >
> > Bart Elshout
>
>
>Aviso Legal:
>Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
>informação confidencial ou legalmente protegida. A incorrecta transmissão 
>desta mensagem não significa a perca de confidencialidade. Se esta mensagem 
>for recebida por engano, por favor envie-a de volta para o remetente e 
>apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o 
>destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.
>
>Disclaimer:
>This message is destined exclusively to the intended receiver. It may 
>contain confidential or legally protected information. The incorrect 
>transmission of this message does not mean the loss of its confidentiality. 
>If this message is received by mistake, please send it back to the sender 
>and delete it from your system immediately. It is forbidden to any person 
>who is not the intended receiver to use, distribute or copy any part of 
>this message.
>
>


>-------------------------------------------------------------------------
>Take Surveys. Earn Cash. Influence the Future of IT
>Join SourceForge.net's Techsay panel and you'll get the chance to share 
>your
>opinions on IT & business topics through brief surveys-and earn cash
>http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


>_______________________________________________
>iText-questions mailing list
>iText-questions@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/itext-questions
>Buy the iText book: http://itext.ugent.be/itext-in-action/

_________________________________________________________________
Exclusieve pop concerten en andere gave video's vind je op msn.nl 
http://video.nl.msn.com/v/nl-nl/v.htm


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to