Skip to content
English
  • There are no suggestions because the search field is empty.

[Public] How to resolve Font Discrepancies Between Windows and Linux in IronPdf on Ubuntu 24?

Addresses the issue where PDFs generated on Linux appear visually different from those generated on Windows due to font discrepancies. It explains how to resolve font rendering issues caused by differences in the default font systems between two OSs.

Issue Overview

When generating PDFs using IronPdf on Linux (Ubuntu 24), the output may look different from what you would see on Windows. Specifically, the issue often arises due to differences in the default font systems. Windows uses Times New Roman by default, while Ubuntu and many other Linux distributions use DejaVu Sans. As a result, text and layout in the generated PDFs may appear inconsistent between the two platforms.

Solution: Installing Microsoft Core Fonts on Ubuntu

To address the font discrepancies, you need to install the Microsoft core fonts on your Ubuntu system. These fonts include Times New Roman, which will match the font used by Windows, ensuring consistency in PDF rendering between the two platforms.

Follow these steps to install the Microsoft core fonts on Ubuntu 24:

1. Install Microsoft Core Fonts

Open a terminal on your Ubuntu system and run the following commands:

sudo apt update
sudo apt install ttf-mscorefonts-installer

This will install the Microsoft core fonts, including Times New Roman, which should resolve the font discrepancy between Windows and Linux.

2. Verify Font Installation

Once the fonts are installed, you can verify they are available by running the following command:

fc-list | grep "Times New Roman"

This should return a list of all the Times New Roman fonts installed on your system.

3. Restart IronPdf

After the fonts are installed, make sure to restart your IronPdf application or service to ensure it picks up the newly installed fonts.

4. Generate PDF Again

Now that the correct fonts are installed, generate the PDF again using IronPdf. The visual differences between PDFs generated on Linux and Windows should be resolved.

 

Before:

 

After:

Conclusion

The visual differences between PDFs generated on Windows and Linux can be attributed to discrepancies in the default font system. By installing the Microsoft core fonts (including Times New Roman) on your Ubuntu 24 system, you can ensure consistent PDF rendering between the two operating systems. This solution should resolve issues related to font rendering in IronPdf when running on Linux.