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

Free Support Forum - aspose.com

Font is not converted properly when exporting to pdf


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Aspose.Words;
using Aspose.Words.Reporting;

namespace Aspose.Words.Examples.CSharp.LINQ

public class Data
public string Name { get; } = “Daudet, Alphonse”;

class HelloWorld

public static void Run()
// ExStart:HelloWorld
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LINQ();

Stopwatch stopwatch = Stopwatch.StartNew();

string fileName = “TestDocument01.docx”;
// Load the template document.
Document doc = new Document(dataDir + fileName);

// Create an instance of sender class to set it’s properties.
// Sender sender = new Sender {Name = “LINQ Reporting Engine”, Message = “Hello World”};

Data data = new Data();

// Create a Reporting Engine.
ReportingEngine engine = new ReportingEngine();

// Execute the build report.
engine.BuildReport(doc, data, “data”);

dataDir = dataDir + RunExamples.GetOutputFilePath(fileName);

// Save the finished document to disk.
// doc.Save(dataDir);

doc.Save(dataDir + “.pdf”, SaveFormat.Pdf);


// ExEnd:HelloWorld
Console.WriteLine("\nTemplate document is populated with the data about the sender.\nFile saved at " + dataDir);

As you can see the font in the pdf file is not the same as the one in the docx file. What’s missing and what can I do to have it export the font properly?

Note that I have to use the ReportingEngine because the final program will have to fill-in data in the document and export it to word and pdf.

Hi there,

Thanks for your inquiry. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you're converting documents to Pdf. Please refer to the following articles:

How Aspose.Words Uses True Type Fonts

We have attached the output pdf with this post for your kind reference.

Thank you so much. The font was missing on the VM I use for development (it doesn’t have Word installed). I used OpenOffice to view the document and it looked fine, and I thought the font is there but it was not. After I copied the font from another computer, the export looked fine.

Thanks again!
Hi there,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.