|
Rank: Newbie Groups: Member
Joined: 11/10/2015 Posts: 2
|
Hello, I am trying to print Chinese characters on a PDF. But they won't show up. It does work on this page for html to pdf: http://www.essentialobjects.com/Products/EOPdf/HtmlToPdf.aspxBut with the following code, I get a blank PDF: Quote: PdfDocument doc = new PdfDocument();
AcmRender render = new AcmRender(doc);
AcmText text = new AcmText("你好");
render.Render(text);
doc.Save(outputFileName);
Is there an option to set the output to UTF-16? Or is there something else i could be doing wrong? Thanks in advance.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, Please explicitly set the font of the AcmText to a Chinese font. For example,
Code: C#
text.Style.FontName = "SimSun";
This is necessary because the default font "Arial" does not have any data for Chinese characthers. Both Windows and the HTML to PDF engine handle this situation with "font substitution". ACM on the other hand is designed to be light-weighted, so it does not have this logic in it's render. As such you must explicitly set the correct font. This does not have anything to do with encoding. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 11/10/2015 Posts: 2
|
This is great, it works!
It is no problem for me to set the FontName explicitly.
Thank you very much!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Glad to hear that! Please feel free to let us know if you have any more questions.
Thanks!
|
|