Word Doc using Times New Roman Converting to LucidaConsole through Aspose.Words

Hi - our Word Doc template file is converting the Times to Lucida Console font when saving the pdf. I have attached the Word and PDF docs as well as the C# code. We are using the Licensed version of Words.

CreatePDF.zip (81.7 KB)

@hlovelaceDCT Usually, the such problems occur because the fonts used in your input document are not available on the machine where document is converted to PDF. The fonts are required to build document layout. If Aspose.Words cannot find the font used in the document, the font is substituted . This might lead into fonts mismatch and document layout differences due to the different fonts metrics. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/

I have tested conversion to PDF on my side and cannot reproduce the problem.

@alexey.noskov I have confirmed that the fonts on the server where the conversion is being performed are stored in c:\windows\fonts. We also uploaded TimesNewRomanPSMT and ArialMTBold fonts to the directory as those were the fonts being used in the document we are attempting to convert. The fonts are still not being translated to the converted pdf. Please advise as to what else could be the issue, thanks.

@hlovelaceDCT Unfortunately, I still cannot reproduce the problem on my side. Have you tried implementing IWarningCallback? Does it show any warnings about font substitutions?

Also, as I can see in your code you reset font sources:

Aspose.Words.Fonts.FontSettings fontSettings = new Aspose.Words.Fonts.FontSettings();
input.FontSettings = fontSettings;
input.FontSettings.ResetFontSources();

Please remove this code to make Aspose.Words to use default font sources.

@alexey.noskov I have removed the the ResetFontSources() code. Where would we check the FontWarnings.Warning to check for a font substitution once IWarningCallback has been implemented? To be more specific, where is that logged?

@hlovelaceDCT IWarningCallback is an interface, in it’s implementation you can log the warning wherever it is convenient to log. For example you can write to the console like this:

private class WarningCallback : IWarningCallback
{
    public void Warning(WarningInfo info)
    {
        if (info.WarningType == WarningType.FontSubstitution)
            Console.WriteLine(info.Description);
    }
}