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

No showing Chinese characters in the pdf file #9

Closed BillFan closed 11 years ago

BillFan commented 11 years ago

Hi,

I'm trying to convert a xhtml page contains Chinese characters to a pdf file. The pdf file created doesn't show the Chinese characters.

I'm running the sample cource code and specified "--fontpath C:\tmp\ARIALUNI.TTF".

Any idea what I'm missing?

Many thanks!

BillFan commented 11 years ago

There were 2 backward slash in the --fontpath value. It appeared only one after I posted the message.

Anyway, I've also try to set "--fontpath C:/tmp/ARIALUNI.TTF", same result, not showing up the Chinese charaters.

allcolor commented 11 years ago

You should also explicitly use the font family in your html. Like font-family: arial in a css rule which is applied on the Chinese text. Regards. Le 6 juil. 2013 05:07, "BillFan" notifications@github.com a écrit :

There were 2 backward slash in the --fontpath value. It appeared only one after I posted the message.

Anyway, I've also try to set "--fontpath C:/tmp/ARIALUNI.TTF", same result, not showing up the Chinese charaters.

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

BillFan commented 11 years ago

Thanks for the reply! I'm now a part time developer, it took me a while to get beck to this work. After another while trying and researching, the font should be using “font-family: Arial Unicode MS;” I could only get my testing code working to display the Chinese characters. YaHP-Converter is still not working for me yet.

BillFan commented 11 years ago

Found the problem, I included the font file name in the value for --fontpath! Stepping through the code, I found it should be just the folder name. It works for me now. Thanks heaps!!