Chinese characters (with Arial Unicode MS font) in word doc, when converted to pdf, shows nothing.

Hi, 

When i convert a docx with chinese characters (set to Arial Unicode MS font), to pdf, chinese characters are not showing.

Please see attached zip file, 

sample.docx - original doc

sample.pdf - converted doc to pdf

Regards,

Yong


Attachment: sample_docs_cbb4bb93.7z

10 Replies

SB Sneha Biju Syncfusion Team January 23, 2024 11:52 AM UTC

Hi Yong,

Upon further analysis of the given details, we suspect that the font used for the Chinese characters (Arial Unicode MS) may be missing on your machine. Therefore, we suggest that you refer to the following KB to resolve any font-related issues during the Word to PDF conversion.
https://support.syncfusion.com/kb/article/13969/how-to-resolve-font-problems-during-word-to-pdf-or-image-conversion

Regards,
Sneha.



YM Yong Montaño January 30, 2024 10:10 AM UTC

Hi Sneha,


I'm running this all on my local machine. Which already has Arial Unicode MS installed.


I'm using DocToPDFConverter, specifically the ConvertToPDF function, with the file path of the docx file.


Regards,

Yong



YM Yong Montaño January 31, 2024 04:16 AM UTC

pdf sample doc properties.jpg

I have attached another pdf and doc sample, the doc sample only has arial unicode MS font, with chinese characters.

After using  DocToPDFConverter, CovertToPDF function. I looked at the doc properties of the pdf and noticed that arial unicode ms is not included in the fonts of the pdf file. But i already have arial unicode ms in my machine. 

arial unicode ms.jpg

What am I missing?


Attachment: sample_6580fc19.7z


AA Akash Arul Syncfusion Team January 31, 2024 12:23 PM UTC

Hi Yong,

We have prepared a sample for finding the missing fonts on your local machine using font substitution which will write the missing fonts in the Console. You can find the sample in the below attachment. We suggest running the given sample in your machine.

If the missing fonts are printed on the console, then kindly install the missing fonts on your local machine.

If the console doesn’t show any font, then please share the “Arial Unicode MS” font that is installed on your machine. This will help us to replicate the reported problem and proceed further.

Regards,
Akash.


Attachment: MissingFonts_885f5d60.zip


YM Yong Montaño February 1, 2024 07:32 AM UTC

Hi Akash,


I played with the app you have provided, and in all of my tests, i was able to generate the chinese text with no problems.. Attached is my machine's installed Arial Unicode MS font.


I'm running my doctopdf code via a web app btw, which is different from your sample app. Am i missing something in IIS or something?


Regards,

Yong


Attachment: installed_arial_unicode_MS_da5cdc37.7z


AA Akash Arul Syncfusion Team February 2, 2024 12:58 PM UTC

Yong, we tried to reproduce the reported issue in the ASP.NET Web App (MVC) by hosting it in IIS. And we can reproduce the reported problem on our end.

The reported issue is not related to DocIO library. We can replicate the reported issue, when creating the font using C# code itself. Please find the code below.

Font font = new Font("Arial Unicode MS", 10, FontStyle.Regular);


Solution:
To resolve this issue, follow the below steps.

1. Uninstall the respective font (in your case “Arial Unicode MS”) from the local machine.
2. Now install the same using the below procedure.

Right click the font file “Arial Unicode MS” -> Install for all users


3. Restart the machine.
4. After restarting, perform the Word to PDF conversion in IIS. Now the font will be preserved.



YM Yong Montaño February 9, 2024 12:43 AM UTC

Hi Akash,


This worked like a charm! Thank you so much for taking the time to help me figure this one out. Now to get this fix on to prod.


Regards,

Yong



YM Yong Montaño February 12, 2024 12:11 AM UTC

Hi,


Additional question, is there a way to replace Arial Unicode MS as the default for rendering chinese characters? As this font no longer ships with Windows and MS Office, is there a way to replace this default font to something else that already comes pre-installed in Windows and/or MS Office.


Regards,

Yong



SB Sneha Biju Syncfusion Team February 12, 2024 12:37 PM UTC

Yong, 

Regarding “is there a way to replace Arial Unicode MS as the default for rendering Chinese characters?”:
Using font fallback feature in DocIO, you can use Arial Unicode MS font as default font when rendering Chinese characters in Word to PDF conversion. To achieve this requirement, you can refer the below documentation.
https://help.syncfusion.com/file-formats/docio/word-to-pdf#fallback-fonts-based-on-script-type

You can also refer the below code snippet to achieve the exact requirement.

document.FontSettings.FallbackFonts.Add(ScriptType.Chinese, "Arial Unicode MS");


If the Arial Unicode MS font is not installed, you can trigger the  SubstituteFont event. You can refer to the below GitHub sample to substitute font without installing in your machine.
https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Word-to-PDF-Conversion/Use-alternate-font-without-installing/.NET-Standard

Regarding “is there a way to replace this default font to something else that already comes pre-installed in Windows and/or MS Office.”:
If you replace the Arial Unicode MS font with any other font, those Chinese characters may not be preserved properly. This is because the Arial Unicode MS font has the required glyphs for Chinese characters. In order to preserve other language characters during Word to PDF conversion, the mentioned font should have the proper glyphs. If it doesn't have the proper glyphs, then the characters may not be preserved properly in the output PDF. We recommend using the Arial Unicode MS font for Chinese characters, which preserves properly.

Else, if you wish to avoid using Arial Unicode MS Font and use some pre-installed fonts means, you can pass the alternate font name in SubstituteFont event, as mentioned here.



YM Yong Montaño February 13, 2024 12:23 AM UTC

Hi Sneha,


Thank you for the comprehensive reply! I will look at this and implement for my code.


Regards,

Yong


Loader.
Up arrow icon