Welcome Guest Search | Active Topics | Sign In | Register

EO.PDF Options
Mark
Posted: Tuesday, November 10, 2015 10:28:28 AM
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.aspx

But 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.


eo_support
Posted: Tuesday, November 10, 2015 10:36:06 AM
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!
Mark
Posted: Tuesday, November 10, 2015 10:43:16 AM
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!
eo_support
Posted: Tuesday, November 10, 2015 10:56:32 AM
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.