Pdf font has been changed by using FontRepository.LoadFonts


I look through “FontRepository.LoadFonts” document, it says that load system fonts and standard pdf font. But my pdf font is different before and after the usage method.

My Html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <style type="text/css">
	body {
	  font-family: 'Arial Unicode MS';
	  font-size: 16px;


my code:

String out = "C:\\Users\\xxx\\Desktop\\1.pdf";
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
Document document = new Document(new FileInputStream("C:\\Users\\xxx\\Desktop\\123.html"), htmlLoadOptions);

// Load PDF document
Document pdfDocument = new Document(out);
Font[] allFonts = pdfDocument.getFontUtilities().getAllFonts();
for (Font font : allFonts) {

the font result is:


when I add


the result is


Why pdf font has been changed? Based on the api document, FontRepository.loadFonts() only load system font, why it impact pdf font?



We used the same code snippet in our environment to test the scenario with Aspose.PDF for Java 21.7 and we got the correct results. The output was “ArialUnicodeMS” in both cases i.e. with and without calling FontRepository.loadFonts() method. Can you please share that in which path your system fonts are installed? Also, please make sure to use the latest version of the API and let us know about your feedback.

Thank you for reply so quickly. I’m using 21.7 and my system fonts are install under C:\Windows\Fonts


We were unable to reproduce the similar behavior of the API on our side. Would you please share the below information so that we can log an investigation ticket to further analyze it?

  • Your complete environment details e.g. OS Name and Version, JDK Version, Application Type
  • Output PDF documents generated at your end with and without calling FontRepository.loadFonts();
  1. Windows 10 version:20H2
    JDK version:14.0.2
    application: intellj idea
  2. attach pdf without calling FontRepository.loadFonts();
    1.pdf (62.5 KB)


It seems like you are using Aspose.PDF without any license. Can you please try to use the API with a permanent or 30-days free temporary license and share your feedback with us? There could be a chance that those different fonts are used by the API for evaluation watermark in the output PDF.