Chinese character rendering issue on PDF while converting HTML to PDF using Aspose.words for java

Hello,


I am converting HTML doc to PDF using aspose.words for Java but facing an issue of Chinese character not being rendered correctly on pdf.

I have downloaded latest jar from your website still the issue persists.

We have licenced version of aspose.words in our firm.

Request you to please assist in this regard as soon as possible.

Attaching HTML and PDF content for your reference.
1. HTML.JPG = HTML file in which chinese character are proper.
2. PDF.JPG = PDF file generated from the above HTML file but chinese character are not rendered properly.

Attaching Code and HTML generated from the same code which is used for generating PDF

1. Code which generates HTML first then PDF from same HTML
2. HTML generated
Hi Gaurav,

Thanks for your inquiry. We have tested the scenario using following code example and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15516. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

HtmlLoadOptions loadOptions = new HtmlLoadOptions();
loadOptions.setLoadFormat(LoadFormat.HTML);
loadOptions.setEncoding(Charset.forName("UTF-8"));

Document doc = new Document(MyDir + "input.html",loadOptions);
doc.save(MyDir + "awjava 17.6.pdf");

ok.

Waiting for a quick resolution.

Thanks.
Hi Gaurav,

Thanks for your patience.

Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you're converting documents to PDF. Please refer to the following article:

How Aspose.Words Uses True Type Fonts

After investigating this issue, we have noticed that you are facing this issue due to missing fonts "Arial Unicode MS" and "DotumChe". Please install these fonts to get the correct output. Please let us know if you have any more queries.

Hello,


Thanks for your reply.
Can you provide DotumChe font or a link may be for linux?

Thanks.

I just installed Arial Unicode MS and the problem is solved.


Thanks for your help.
Hi Gaurav,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

HI Friend ,

I am using licensed version of aspose.word in our company product which is made of .Net library in windows platform.
I too facing the same issue, can you please provide me the respective link to download these fonts that you have mentioned.

Thanks,

@susil,

Thanks for your inquiry. You can try Google Noto Fonts which is a collection of fonts that cover most of the ranges specified in the Unicode standard. Hope this helps you.

Best Regards,
Tahir Manzoor

Please Look into the attached screen shot.Untitled.png (201.4 KB)
for this issue.

Please Provide a particular download link.

@susil,

Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you’re converting documents to PDF. Please refer to the following article:

How Aspose.Words Uses True Type Fonts

Could you please share your input document here for testing? We will investigate the issue and let you know the fonts that you need to install on your system.

Best Regards,
Tahir Manzoor

Thanks for your Support Tahir. I found the font which worked for me. It’s “wts11.ttf”.

@susil,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Best Regards,
Tahir Manzoor

Related to this issue:

    val stream: InputStream = new ByteArrayInputStream(htmlDecoded.getBytes(StandardCharsets.UTF_8))
    val loadOptions = new LoadOptions()
    loadOptions.setEncoding(StandardCharsets.UTF_8)
    val doc: Document = new Document(stream, loadOptions)
    val docOutStream: ByteArrayOutputStream = new ByteArrayOutputStream()

    doc.save(docOutStream, formatType)

Currently we have a html and wanted to convert to pdf, but some characters show as a rectangles.

aspose_word_14_special_characters_pdf.zip (42.0 KB)

Please let me know how to solve the issue.

thanks.

@mauricio.gomez.77,

Thanks for your inquiry. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you’re converting documents to PDF. Please refer to the following article:

How Aspose.Words Uses True Type Fonts

We have tested the scenario using latest version of Aspose.Words for Java 18.5 and have not found the shared issue. Please use Aspose.Words for Java 18.5. We have attached the output PDF with this post for your kind reference. 18.5.pdf (66.7 KB)