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

Free Support Forum - aspose.com

Retain Font Type when Converting DOCX Word Document to PDF using C# Java | Find actual Font Names of the TTF Files

Hi Support,
I am facing an issue while converting .Docx document to PDF using Aspose.words(18.1.0.0) as the font style is changed where as if I convert the document using Microsoft Word, the resultant PDF retains the original font style.
I have attached the document as well as the font files with this support task.
Font Type Change - Issue.zip (63.5 KB)

Regards

@Wahaj_Khan,

Please see the following screenshot that reveals the actual Font names of the TTF files you shared:

But, we need the following Fonts for proper rendering of this DOCX to PDF:

  • Bliss 2 Regular
  • Bliss 2
  • Bliss 2 Bold

So, please provide correct Font files here for further testing.

Hi @awais.hafeez
We only have provided fonts that are already added in attached Font Type Change - Issue.zip.
Regards

@Wahaj_Khan,

We have installed the three font files that you provided earlier. After that when we use MS Word 2019 to convert your ‘Font type test.docx’ document to PDF format, by default it performs the font substitution in the following order:

Using the above default settings, we have converted it to PDF and attached MS Word 2019 generated PDF file here for your reference:

And when we explicitly add font substitution (like MS Word 2019 does), the output of MS Word and Aspose.Words will become the same:

C# Code:

Document doc = new Document("E:\\Font Type Change - Issue\\Font type test.docx");

FontSettings fs = new FontSettings();
fs.SubstitutionSettings.TableSubstitution.AddSubstitutes("Bliss 2", new string[] { "Times New Roman" });
fs.SubstitutionSettings.TableSubstitution.AddSubstitutes("Bliss 2 Bold", new string[] { "Calibri" });
fs.SubstitutionSettings.TableSubstitution.AddSubstitutes("Bliss 2 regu", new string[] { "Times New Roman" });
fs.SubstitutionSettings.TableSubstitution.AddSubstitutes("Bliss 2 Regular", new string[] { "Calibri" });
doc.FontSettings = fs;

doc.Save("E:\\Font Type Change - Issue\\awnet 20.7 after adding Font Substitutes.pdf");

Hi @awais.hafeez
I have a confusion regarding:

How can I know using Aspose that I need to perform font substitution on the following document and by which font it should be substituted?
Regards

@Wahaj_Khan,

Please refer to the following section of documentation:

Put simply, please make sure that the fonts used in Word document are installed/available on the machine where you are performing Word to PDF conversion by using Aspose.Words.

In case you have further inquiries or may need any help, please let us know.