We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with Loading Both TTF & OTF Fonts while converting HTML to PDF

Hi,

We are requirement for converting HTML to PDF, we are using Aspose words 10.8.0 version of Java for this purpose.

The Html content contains, Japanese and other language characters,

When we use OTF Fonts and convert HTML to PDF, the PDF size grows exponentially, as i think the OTF Fonts are getting embedded in the PDF,

This doesnot happen if we convert HTML to PDF using TTF Fonts ,

So we want to use OTF Fonts for Japanese and TTF for English languauge, we are specifying multiple Font directories, one of folder contains TTF fonts (This doesnot have Japanese fonts) and other OTF fonts (This has only OTF Japanese fonts).

When we execute the program, if the first location is TTF Font location, Then japanese charcters are not rendered, if i change the order then only OTF Fonts are used.

I have 2 questions

  • Is there is way to Load both TTF & OTF fonts and use respectively or
  • Can we skip embedding of OTF Fonts, to avoid drastic increase in PDF size

Attached Sample Test program and Input HTML.

Please suggest

Hi Ragha,


Thanks for your inquiry.

First of all, please note that by default, Aspose.Words doesn’t embed any font (OTF or TTF) inside PDF document unless you explicitly specify true to PdfSaveOptions.setEmbedFullFonts property.

Secondly, I tried converting your HTML file to PDF format with Aspose.Words v11.1.0 on my side and the size of this PDF file was just 91k which seems to be fine in your case. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.1.0 and let us know how it goes on your side. I hope, this will help.

Moreover, currently there is no way to instruct the rendering engine of Aspose.Words to embed Fonts of your choice in the output PDF.

Also, you can use DocumentVisitor to change the font of your document before rendering to PDF. Please see the following thread:
http://www.aspose.com/community/forums/342247/smart-font-selection/showthread.aspx#342247

Please let me know if I can be of any further assistance.

Best Regards,

Thanks for clarifying