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

Free Support Forum - aspose.com

Unsupported fonts for docx to png conversion

Hello,
I’ve already read documentation about rendering fonts and IWarningCallback, so it’s just a little question for conversion from text to image files. Is there any possibility to save Document with unsupported in a system fonts by considering this strings just as pictures? (I presume “No”, but I should to ask. Sorry)

Thank you in advance

Hi Akane,

Thanks for your inquiry. Could you please share some detail about your query related to unsupported fonts? Please note that Aspose.Words requires TrueType fonts when
rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). Make sure
you have all the Fonts installed on your machine you’re using to convert
Word document to image format. I would suggest you please read the
following articles:
http://www.aspose.com/docs/display/wordsjava/How+Aspose.Words+Uses+True+Type+Fonts
http://www.aspose.com/docs/display/wordsjava/How+to++Specify+True+Type+Fonts+Location

You may use addFontSubstitutes method to substitute (alternative) font names for given original font name.

FontSettings.addFontSubstitutes(“Microsoft YaHei”, “MSungGB18030C-Medium”);
Document doc = new Document(getMyDir() + “input.docx”);
doc.save(getMyDir() + “out.png”);

Hello,

Thank you very much for your reply.
I’ve already read this documents and wanted without much hope to make sure that fonts are necessary for exact conversion.


Actually we already use

ArrayList
fontSources = new ArrayList(Arrays.asList(FontSettings.getFontsSources()));

fontSources.add(new FolderFontSource(getFontPath(), true));

FontSettings.setFontsSources(fontSources.toArray(new FontSourceBase[fontSources.size()]));



So the problem occurs during conversion of documents with unsupported MS fonts. (We don’t have license to use these fonts)
The fact is that converter don’t work correctly with Japanese text because:

Font ‘MS Gothic’ has not been found. Using ‘Times New Roman’ font instead.
In this case Japanese symbols are not shown correctly.

I tried to set default font as null and in spite of there is ‘MSungHK-Light’ font for Japanese symbols on our machine ‘Trebuchet’ was set automatically. But this font is not appropriate too…



Thank you for tip on addFontSubstitutes method. It works perfectly. But it is not ideal variant because we don’t know which unsupported font can be found next time.

I thought maybe there is any way to substitute font names for given original font name dynamically. What about FontInfo class? Is it possible to learn set of supported languages?
Could you please so kind to give any advise on this issue?

Thank you in advance.

Hi Akane,

Thanks for your inquiry. I am afraid there is no other solution for your scenario. You need to use true type fonts. As I shared in my previous post, Aspose.Words requires TrueType fonts when
rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). So, please use true type fonts for document conversion to fixed file format.

Anyway thank you for your replies.