Free Support Forum - aspose.com

Resolving Chinese and Japanese while saving document to PDF

Dear Team,

I am converting a docx to pdf file.
I have set of fonts metrically equivalent to MS Core fonts. Before start processing the document, I am changing the fonts name of all Runs. for ex: Arial to Roboto. This case is working fine for english, and latin characters.

The problem is in Chinese and Japanese character. Aspose words fails to replace font name of those characters. in final pdf, the Chinese character value is lost completely.
I do have fonts like zysong.ttf, fireflysung.ttf

I referred this help, but didn’t find the APIs in Java.

How can we specify the font name for Chinese and Japanese character ?

Attachments:
PDF and DOCX here Archive 2.zip (63.9 KB)

@ganesh.sv,

You are using a very old version of Aspose.Words for Java i.e. 16.7 on your end. When using the latest version of Aspose.Words for Java i.e. 18.10, we do not see any issue on our end (see awjava-18.10.pdf (86.5 KB)). The file was generated by using the following simple code:

Document doc = new Document("D:\\Archive 2\\other_lang (2).docx");
doc.save("D:\\Archive 2\\awjava-18.10.pdf");

Please upgrade to the latest version from the following link. Hope, this helps.
https://downloads.aspose.com/words/java

P.S: you might see some minor difference because the following fonts were not installed on our end:

  • Shree Devanagari 714
  • Tamil MN
  • inherit

Please install them to get the proper output.

@awais.hafeez,
Screen Shot 2018-11-01 at 2.27.53 PM.png (359.1 KB)

As per document properties shared in the screen shot, The fonts listed supports unicode characters including and Chinese and Japanese and there is not issue in conversion to pdf in my end either.

We are going revoke the license of MS Core fonts and looking for some open sourced fonts. We do have installed open source fonts like like zysong.ttf, fireflysung.ttf that support Chinese and Japanese characters. In this case, while exporting to PDF, values is omitted from in exported PDFs.

Please suggest solution for it.

@ganesh.sv,

Please also ZIP and attach these two font files here for further testing.

Dear @awais.hafeez,

I am attaching the font.zip.
Please check the attachments for Chinese and Japanese fonts ttf file.

URL of zip fonts

https://docs.zoho.com/file/aov8b3c077aa37891400ca2bdde5e7c5d6dc8

@ganesh.sv,

We get this new output.pdf (13.0 KB) when specifying only the font folder (by using FontSettings.SetFontsFolder method) containing only the fonts you provided via link. Put simply, to be able to render this document correctly, you need to place the following font files in your font folder:

  • ‘Cambria’
  • ‘Calibri’
  • ‘Arial’
  • ‘Times New Roman’
  • ‘Verdana’
  • 宋体
  • ‘Shree Devanagari 714’
  • ‘Tamil MN’
  • ‘inherit’