Text Font Changes in DOCX Template Conversion to PDF in C# using Aspose.Words REST API

When a PDF document is downloaded within our application, it has a totally different font then what is set up in template.

This is the word template, with font Segoe UI:

This is the output PDF file:

This issue has only started happening overnight. Please let me know what is going wrong.
image.png (21.7 KB)
image.png (27.1 KB)

@it_tidyinternational can you please provide further details about your environment?
Additionally can you please check that the font is available in your running environment. If a font is not available and accessible by Aspose.Words API it automatically replace the missing font with another. You can easily check for font substitutions implementing the interface IWarningCallback:

public class IssueCallBack : IWarningCallback
{
    public void Warning(WarningInfo info)
    {
        Console.WriteLine(info.Description);
    }
}
Document document = new Document();
document.WarningCallback = new AppendIssueCallBack();

Hello Eduardo,

We have a .NET solution that issues

  • POSTs - of a Word templates
  • GETs - requesting PDF conversion
  • DELETE - if not to be retained.

As to the font availability, the issue is rather moot in that requests using the the same template randomly use the correct and wrong fonts.

It is almost as if one of the Servers(Services) at your end is missing a basic font library.
Noting that this only recently started happening.

Cheers
Peter

image.png (14.4 KB)

For additional reference, a conversion was attempted 3 times with the same template.
The first two made use of the correct font, but the 3rd was wrong.

the query appear similar

Success: Export the document into the specified format… name ‘f8cbe725-43db-4756-8614-cff74d667dc4.af1074e2-bff8-4c72-a516-abd2b5b794b3.docx’,format ‘pdf’,folder ‘7262662a-5efc-4f73-b4ec-7cc2cafa0456’,outPath ‘’

Success: Export the document into the specified format… name ‘f8cbe725-43db-4756-8614-cff74d667dc4.23c5880c-8711-4a97-b3ec-dc70a089bdb2.docx’,format ‘pdf’,folder ‘7262662a-5efc-4f73-b4ec-7cc2cafa0456’,outPath ‘’

The request trace ID may assist in identifying different processing paths
Request Trace Ids
1-642e3a04-2b52eb784b59c0852e2e2e35 = Fault
1-642e39fa-2d181a85193cb5e958e387da = OK
1-642e39e0-6add941d55b94f8938ed1bad = OK

image.png (50.8 KB)

@it_tidyinternational Do you use Cloud or on-premises version of Aspose.Words API?

Hello Alexey

we use your cloud service …
...//api.aspose.com/...

Cheers
Peter

@it_tidyinternational thank you for additional information. I will move the topic into the appropriate forum. My colleagues from Cloud team will help you shortly.

@it_tidyinternational

We are sorry for the inconvenience. We are in between migration to new server so you are getting the issue due to missing fonts. You can upload the missing fonts to a storage folder and pass the folder path in the fontLocation parameter in the request. It will resolve the issue.

Hello Tilal, We are having a similar issue with Aspose cloud word. When will the issue be resolved on your side or do we have to fix this ourselves with a font folder as mentioned?

@bedarley111111

The Mail Merge APIs do not support the usage of custom fonts. Anyways, please check your original post for details.

Hello Tilal,

It is not strictly an issue of just totally missing fonts.

It is a matter of selectively / randomly not using a font.

As described, the SAME document can be processed and randomly be returned with the correct font some times and with the wrong font other times.

@it_tidyinternational

Thanks for your feedback. Initially we have noticed that the issue has been raised because of missing fonts on the new production server. However, we have logged a ticket WORDSCLOUD-2290 for further investigation.

Meanwhile, we will appreciate it if you please also share your input document along with the sample code. It will help us to investigate and address your issue exactly.

not sure how much code you want .
Essentially the workflow is to upload a template, request a conversion, (delete the file from storage)

       url = "http://api.aspose.com/v1.1/storage/folder/" + options.Template.Folder;
       ProcessCommand(url, "PUT");

                    
        byte[] fileContents;
        string url = String.Format("http://api.aspose.com/v1.1/words/{0}?format={1}&folder={2}", response.Document.FileName, 
            options.GetFormatCode(), options.Template.Folder);
        using (var responseStream = ProcessCommand(url, "GET"))
        {
            fileContents = ReadStream(responseStream);
            responseStream.Close();
        }
        return fileContents;

A simple template is …230412A.docx (16.2 KB)

our estimate is that about 50% of the time we get …
image.png (12.7 KB)

and the other times …
image.png (15.9 KB)

@it_tidyinternational

Thanks for your sample code. I am afraid you are using the obsolete API Version 1.1. Please use the latest API Version 4.0 and share the results.

Aspose.Words Cloud Convert APIs