Fonts don't carry over from word to PDF


Hello, I’m using Aspose.Words in a .net core 2.2 application. When I save my document (built with DocumentBuilder) with the following code:

var docStream = new MemoryStream();
builder.Document.Save(docStream, saveFormat);

Saving as a docx uses the correct font specified. However, when saveFormat is PDF, the generated document no longer uses the font selected (Baskerville). It is worth noting when I run this in my local dev environment on Windows, both documents contain the correct font, whereas on our dev/production servers running Linux, only the Word document is correct.

I don’t expect this is an issue with installing fonts on the Linux image, as it works correctly for the Word document.



In order to render your Word documents to PDF (and XPS, Images etc) with best fidelity, we would suggest you please simply copy/install the required font files from Windows to your Linux machine. Please refer to the following section of documentation for more details:

How Aspose.Words Uses True Type Fonts during rendering to PDF


I’ve followed those instructions already (installing the Ubuntu package using apt) - if it were an issue of the fonts not being present on the system wouldn’t they fail to show up in the Word Document as well?



Aspose.Words requires fonts only during rendering to fixed-page formats such as PDF, XPS, images. It does not use fonts during saving to flow-formats such as DOCX, DOC, RTF etc. When you open Aspose.Words generated Word document, the editor will automatically pick suitable system fonts and format the text on the fly.

Please ZIP and upload your sample Word document, Aspose.Words generated PDF file showing the undesired behavior and required Font files here for testing. We will then investigate the issue on our end and provide you more information.