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

Free Support Forum - aspose.com

Word to PDF conversion not using font substitution

When I try to convert a word document to pdf that contains symbols the result pdf is like Attacment1.png. I use bellow code to do this conversion:


var document = new Aspose.Words.Document(sourceFilePath);
var saveOption = new Aspose.Words.Saving.PdfSaveOptions();
saveOption.NumeralFormat = Aspose.Words.Saving.NumeralFormat.Context;

var fontSettings = FontSettings.DefaultInstance;
foreach (FontInfo fontInfo in document.FontInfos)
fontSettings.SetFontSubstitutes(fontInfo.Name, fontSettings.DefaultFontName);

document.FontSettings = fontSettings;
saveOption.FontEmbeddingMode = Aspose.Words.Saving.PdfFontEmbeddingMode.EmbedNonstandard;
document.Save(resultFilePath, saveOption);

I attached sample document and used font.

Hi Freydoon,


Thanks for your inquiry. We have tested the scenario and have not managed to reproduce the same issue at our side. I have attached the output generated from the above code snippet, using the latest version of Aspose.Words for .NET.


For more information please visit Font Availability and Substitution & True Type Fonts. If you still face any problem, please let us know we will try to help you as much we can. Thanks.

You're right, I forgot to add default font to the source font folder.

Thanks
Hi Freydoon,

I am glad it fixes your issue. If you face any issue regarding Aspose.Words, please let us know we will try to help you as much we can. Thanks.
Hi again
My problem is resolved in the current version of my application, but my clients used an older version of my application and it use Aspose.Words version 15.6.0.0, I can't update those to last version of Aspose.Words, they have the above problem and I set font substitution like below code, but it's not work.

var document = new Aspose.Words.Document(sourceFilePath);

foreach (FontInfo fontInfo in document.FontInfos)
FontSettings.AddFontSubstitutes(fontInfo.Name, FontSettings.DefaultFontName);
var saveOption = new Aspose.Words.Saving.PdfSaveOptions();
saveOption.NumeralFormat = Aspose.Words.Saving.NumeralFormat.Context;

document.Save(resultFilePath, saveOption);


In this version of Aspose.Words I can't set document's FontSetting and all document use global FontSettings.
I attached a new document and font that have this problem in this version of Aspose.Words.
It seems the problem is font fallback. I used system font folder and Arial Unicode MS is installed. Is there any way to resolve this problem without update clients?

Hi Freydoon,


Thanks for your inquiry. After an initial test with Aspose.Words for .NET 16.12.0, we were unable to reproduce this issue on our end (see attached PDF output).

We would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link:
http://downloads.aspose.com/words/net

Unfortunately, it is difficult to say what the problem is and how to resolve this using an old version of Aspose.Words for .NET 15.6.0. Please note that we don’t provide support for older versions of Aspose.Words and we do not provide any fixes or patches for old versions of Aspose products either.

We always encourage our customers to use the latest version of Aspose.Words (to date it’s 16.12.0) as it contains newly introduced features, enhancements and fixes for issues reported earlier. Thanks for your understanding.

Best regards,

Thanks for the prompt reply