German characters not rendering | Docx to Pdf | Aspose onPremise | Node.js

Hi team,

I have a docx file that contains few parts of the document text in german. So when using the cloud api , the german chars are rendering fine but when using the onpremise thegerman chars are not rendering.

Can you please suggest which font [ttf] needs to be added inorder to render the german chars.

@Uzair_Sayeed Could you please attach your problematic output document here for our reference? I have checked conversion on my side and the output looks correct:

Hi @alexey.noskov , thanks for quick response.

And I hope you are using aspose words onpremise node.js for the conversion[out.pdf file]

@Uzair_Sayeed Unfortunately, I do not see any problems in the attached PDF. If possible could you please highlight the problem?

Actually, there is no on-premises version of Aspose.Words for node.js. Aspose.Words on-premises is availabe for .NET, Java, Python and C++. Could you please share the code you use code conversion? Also as I can see the producer of the attached PDF is not Aspose.Words.

Sorry @alexey.noskov , my mistake I’ve sent the wrong output pdf file.

Here’s the actual output file:

We are using aspose onpremise via Node.js for quite sometime.

Code:

docxToPdfConverterAsposeV3: async (inputDocxFilePath) => {
        try {
            var axios = require('axios');
            var FormData = require('form-data');
            var fs = require('fs');
            const asposeDocxToPdfUrl = getAsposeDocxToPdfUrl();
            var data = new FormData();
            data.append('document', fs.createReadStream(inputDocxFilePath));

            var config = {
                method: 'put',
                // url: 'http://aspose-words-cloud.document-service-backend.svc.cluster.local/v4/words/convert?format=pdf&fileNameFieldValue=sourceFilename',
                url: asposeDocxToPdfUrl,
                headers: {
                    'accept': 'application/octet-stream',
                    'Content-Type': 'multipart/form-data',
                    ...data.getHeaders()
                },
                data: data,
                maxContentLength: 50000000,
                maxBodyLength: 50000000,
                responseType: 'stream'
            };

            let result = await axios(config)
            return {
                contentType: result.headers['content-type'],
                filestream: result.data
            };
        } catch (error) {
            let apiError = new APIError('50090', error, 'Aspose - Internal Server Error');
            logger.error(`Error occured while converting docx file to pdf`, apiError);
            throw apiError;
        }
    },

In the above code, ‘aspose-words-cloud’ is the name of our kubernetes deployment and ‘document-service-backend’ is the namespace used. We are hitting the aspose pod svc url from our backend url.

@Uzair_Sayeed

Please note that you are getting the issue due to a missing custom font. There are two options to use custom fonts in Aspose.Words Cloud Docker Container. Either you can copy custom fonts directly to the /fonts volume or create a custom fonts folder in the /data volume and pass this path as the fontsLocation parameter value in the API call.

@tilal.ahmad , sure. Thanks.

But can you tell me inorder to support german chars which font is generally needed.

@Uzair_Sayeed

I am afraid we cannot generalize any font for German characters. Please note that you are using Arial font for German characters in your input Word template, so you can upload it to the /fonts volume or some custom fonts folder in cloud storage and use it accordingly.

@tilal.ahmad , for now can you remove the png image from the public forum.

As you already have the original doc file, you can also check that for some characters [probably the ones which are in german] MS word is showing the font as ‘consolas’. I tried to upload the same font but still its not working.There are a lot of alignment issues found in the converted pdf file.

As you have the original docx can you tell me what all fonts are to be added on the onpremise cloud storage to make this thing work.

From here I’ve downloaded the consolas font : Consolas Font Free - Dafont Free

It would be of great help , if you can mention what all fonts are added in the aspose words cloud api. Since cloud api is working fine for german chars. If you give me the list of cloud api fonts then I can add all the relevant font files in the onpremise cloud storage .

@Uzair_Sayeed

I am afraid I cannot find the text with the consolas font in your shared input Word document. Please select the word and share a screenshot for reference.

@Uzair_Sayeed

Please check the GetAvailableFonts method to get a list of the fonts from Aspose.Words Cloud server. These are the fonts that come with Windows Server.