Convert Word to PDF in Node via Aspose.Words REST API Korean Characters Rendering Issue

Hi Team,

Im trying to convert a docx file to pdf file via aspose on premise. The file is rendering fine but the korean characters are not rendering properly . Korean characters are getting replaced with rectangular boxes.

Aspose Words Cloud image used -> latest and have also tried with image 22.12
Screenshot:
image.png (11.1 KB)

When im using aspose words cloud api directly [Non-onpremise] the korean characters are rendering fine.
Screenshot: image.png (9.2 KB)

1 Like

@userDPWDocSer

Please note that this issue is usually caused by missing fonts. If you are using some custom fonts in your input document, then you need to upload the fonts to a storage folder and pass the folder path in the fontLocation parameter in the request.

Hopefully, it will resolve the issue. Otherwise, please share your input document along with the custom font as a zip file. We will investigate the issue and share our findings with you.

Hi @tilal.ahmad,

We are not using any custom fonts there. As I mentioned the korean chars are rendering fine if I making a call to aspose words cloud api directly. This issue is only happening incase of on premise workflow.

Input docx file
korean_chars_isse.docx (69.1 KB)

@userDPWDocSer

Kindly note that Aspose hosted cloud service includes Windows Server default fonts, so you are not facing this issue on our cloud service. In the case of a self hosted solution, Aspose.Words Cloud Docker Container does not include the fonts, so either you need to upload your fonts to the default fonts volume or create a new fonts folder in the data(storage) volume. If you upload your fonts to the fonts volume, then you do not need to use the fontsLocation parameter; otherwise, pass the fontsLocation in the API call.

@tilal.ahmad, I’ve added korean fonts at the mounted fonts location but still the korean chars are not rendering. Apart from that I had also added a few other custom fonts file at the mounted fonts location and they are rendering fine. Those custom fonts are properly rendering except the korean chars.

The korean fonts file are also present inside the aspose words pod.
Screenshot -> image.jpg (179.6 KB)

var axios = require('axios');
            var FormData = require('form-data');
            var fs = require('fs');
            const baseUrl = getAsposeEndpoint();
            var data = new FormData();
            data.append('document', fs.createReadStream(inputDocxFilePath));

            var config = {
                method: 'put',
                url: baseUrl + '/v4/words/convert?format=pdf&fileNameFieldValue=sourceFilename',
                headers: {
                    'accept': 'application/octet-stream',
                    'Content-Type': 'multipart/form-data',
                    ...data.getHeaders()
                },
                data: data,
                responseType: 'stream'
            };

            let result = await axios(config)
            return {
                contentType: result.headers['content-type'],
                filestream: result.data
            };

This is how Im making the call. Can you please tell me if Im missing something here?

@userDPWDocSer

I have noticed that the Aspose hosted service is replacing the Calibri font of Korean characters with Malgun Gothic. As your Docker container does not have Malgun Gothic or some other replacement font, it renders Korean characters as rectangular boxes. We have logged a ticket(WORDSCLOUD-2242) to investigate and fix the issue. Meanwhile, you can upload the Malgun Gothic font to your font volume as a workaround.