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

Free Support Forum - aspose.com

Aspose Save Japanese fonts from image of word document

hi…I am using aspose for save Docx data, When I upload docx & save data with image which has some japanese & english text but not able to save japanese fonts its shows boxes instead of text.it saves only english text in image properlyaspose-image-bug.jpg (147.6 KB)

@kamlesh17268 Could you please attach your input and output documents here for testing? We will check the issue and provide you more information.
The problem might occur because the fonts used in your document are not available in the environment where document is rendered. Please see Aspose.Words documentation to learn more about using true type fonts.
You can try implementing IWarningCallback to get warnings about font substitutions.

Input.docx (60.0 KB)
you can upload this doc for input and try to convert that into html.

@kamlesh17268 Thank you for additional information. The document is converted properly in both HTML and HTML_FIXED formats on my side.
Most likely fonts used in your document are not available on the machine where conversion is performed. Aspose.Words substitutes the unavailable font and warns. You can implement IWarningCallback to catch these warnings. See the following code for example:

Document doc = new Document("C:\\Temp\\in.docx");
doc.setWarningCallback(new FontSubstitutionWarningCallback());
doc.save("C:\\Temp\\out.html", SaveFormat.HTML_FIXED);
private static class FontSubstitutionWarningCallback implements IWarningCallback {
    public void warning(WarningInfo info) {
        if (info.getWarningType() == WarningType.FONT_SUBSTITUTION)
            System.out.println(info.getDescription());
    }
}

aspose-sample.zip (56.9 KB)
I have tried your code but its not working.
I have attached our sample code zip. this zip has Java Maven Project you can build and run as JAVA Project. You can get output.html in same folder after running project. we are not able to generate Japanese fonts in shapes, can you please check and provide us solution.
Thanks

@kamlesh1293 As I can see from your project you are using quite old version of Aspose.Words 15.12.0. Please try using the latest 22.2 version and let me know if the problem still persists on your side.

@alexey.noskov thanks we have tried your solution by using latest aspose version and now we are able to generate proper output.
Thanks & Regards,
Kamlesh

@kamlesh1293 It is perfect that the problem is resolved. Please feel free to ask in case of any issues. We are always glad to help you.

@alexey.noskov We are using Linux and the font that is needed is MS Gothic. so its not working after deployment, so where do we need to install the fonts ? or how can we specify the fonts to be used from the aspose code?

below is Linux version:

NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"

@kamlesh1293 You can put the required fonts in any accessible folder and specify the folder as fonts source. Or you can install the fonts as described in our documentation.