When convert word to pdf- some chinese character result in square

Hi,
I use the Aspose.Words.dll(version 9.1.0.0) to convert a word document to the pdf. Some words use the font “宋体”, the corresponding font file is “simsun.ttc”. some word use the font “仿宋”, the corresponding font file is “simfang.ttf”. But in the result file, all the characters use the font “宋体” display fine, the characters use the font “仿宋” display as a square.
I have read the post https://forum.aspose.com/t/81989. alexey.noskov said Currently Aspose.Words does not support reading TTC fonts, upon rendering alternative TTF font is used.
But the result is that the characters use the TTC fonts correctly converted, the characters use the TTF fonts failed to convert.
So what’s wrong? how to resolve?
Thank you.

Hi

Thanks for your request. The problem with TTC fonts was fixed few releases ago. Could you please attach your documents (input and output) and fonts here for testing? I will check the issue and provide you more information.
Best regards.

Thank you for your replay.
The file word1.docx is input, and the word1.docx.pdf is the output.
The word file uses two font, one is simsun.ttc, and other is simfang.ttf.

Hi

Thank you for additional information. I cannot reproduce the problem on my side. I have installed your fonts, and converted the document using the following code:

Document doc = new Document("Word1.docx");
doc.SaveToPdf("Word1.pdf");

I send the document produced on my side to your e-mail.
Best regards,

Thank you for your replay.
This is very strange. I have try this code in a winform project and a web project. Both of them output same result , some characters display as square. It looks like the Aspose.Words doesn’t load or import the font files correct in my computer.
Does there exists some settings can enable Aspose.Words output some logs, and then I can trace the problem.
Or counld you give an code example to load an assigned font file while the coverting process.
By the way, My operating system is windows 7, does this related?

I have try to run the same code on an english operating system (window 7), the output file looks fine. But on an another chinese operating system (window 7), the issue is reappeared.
So, I couldn’t understand why Aspose.Words works fine in an english operating system, but failed in a chinese operating system.

Hi

Thanks you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
As a simple workaround, you can try using the following code:

CultureInfo currentUICulture = Thread.CurrentThread.CurrentUICulture;
Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
Document doc = new Document(@"Test001\in.docx");
doc.SaveToPdf(@"Test001\out.pdf");
Thread.CurrentThread.CurrentUICulture = currentUICulture;

Hope this helps.
Best regards.

Hi,
Thank you. I have a try, but there are no any effect.
My Code as follow:

private void button1_Click(object sender, EventArgs e)
{
    CultureInfo currentUICulture = Thread.CurrentThread.CurrentUICulture;
    Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
    Document doc = new Document("Word1.docx");
    doc.SaveToPdf("Word1.pdf");
    Thread.CurrentThread.CurrentUICulture = currentUICulture;
    MessageBox.Show("Successful");
}

Characters in the pdf also display as square.

Hi

Thank you for additional information. Have you tried with other cultures? For example, try specifying English culture? Like shown below:

CultureInfo currentUICulture = Thread.CurrentThread.CurrentUICulture;
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Document doc = new Document(@"Test001\in.docx");
doc.SaveToPdf(@"Test001\out.pdf");
Thread.CurrentThread.CurrentUICulture = currentUICulture;

Best regards.

Thank you for your replay. That’s work. Thank you.

The issues you have found earlier (filed as 18337) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.