allcolor / YaHP-Converter

YaHP is a Java library that allows you to convert an HTML document into a PDF document.
GNU Lesser General Public License v2.1
56 stars 23 forks source link

Not Showing Chinese character #17

Closed sivasom closed 10 years ago

sivasom commented 10 years ago

Hi,

Chinese characters are not coming proper (Junk characters are coming)

Example

Input:- 当地及全球因素总览 output:- «O?¤è®×??¤u¨ã

Thanks & Regards, Soma

allcolor commented 10 years ago

You have to embed a truetype font that contains these character and explicitely use that font in your html.

See: http://www.allcolor.org/YaHPConverter/samples/test2.html which use MS Arial Unicode truetype font.

For that set the properties.put(IHtmlToPdfTransformer.FOP_TTF_FONT_PATH, fontPath);

fontpath must point to a path containing the TTF font you want to be able to embed.

And in your html, you have to explicitely set the css font-family to the font you want like this for example:

you text and non latin char

Quentin

2013/11/6 sivasom notifications@github.com

Hi,

Chinese characters are not coming proper (Junk characters are coming) Example

Input:- 当地及全球因素总览 output:- «O?¤è®×??¤u¨ã

Thanks & Regards, Soma

— Reply to this email directly or view it on GitHubhttps://github.com/allcolor/YaHP-Converter/issues/17 .

All those moments will be lost in time, like tears in rain.

sivasom commented 10 years ago

Hi Quentin,

Is there any other we can get the chinese character without using truetype font.

I am sure we can use truetype font in our application.

Thanks & Regards, Soma

allcolor commented 10 years ago

No, PDF can only have non-latin character by embedding a font.

2013/11/6 sivasom notifications@github.com

Hi Quentin,

Is there any other we can get the chinese character without using truetype font.

I am sure we can use truetype font in our application.

Thanks & Regards, Soma

— Reply to this email directly or view it on GitHubhttps://github.com/allcolor/YaHP-Converter/issues/17#issuecomment-27867330 .

All those moments will be lost in time, like tears in rain.

satishchitimoju commented 6 years ago

Hi Allcolor, I am using multiple languages. japanese chinese french dutch ext.. So How to setup multiple languages, properties.put(IHtmlToPdfTransformer.FOP_TTF_FONT_PATH, multiTTFFilePath); But i didnt get the proper japanese data. Could you please help me out.