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

Free Support Forum - aspose.com

FontEmbeddingException: Font embedding is prohibited because of font license restrictions

I am using java on linux. I am trying to convert html to pdf and on some linux boxes we are getting the exception “FontEmbeddingException: Font embedding is prohibited because of font license restrictions”. This does not occur on all linux boxes for the exact same html. The html uses “font-family: arial, helvetica, sans-serif, serif;”. I can’t find where any of those fonts are installed on any of the linux boxes and yet some throw the exception and some don’t. The linux boxes are not all the same version of linux. Could that have something to do with it?


The exception may be due to the environment limitations as some of the fonts require license in non-Windows systems like Linux. You can please try to disable the license verification by using below line of code and feel free to let us know in case you notice any issues:

Document document = new Document(dataDir + "threaddump.pdf");

It is throwing the exception when I am calling new Document(). Also, I don’t believe that those fonts exist on any of the linux servers and yet it works on some but not on others. Is it doing its own font substitution? I can’t find arial, helvetica, sans-serif, or serif on any of our linux servers.

public static ByteArrayOutputStream convertHtmlStreamToPdfStream(InputStream in) throws Exception {
    HtmlLoadOptions htmlOptions = new HtmlLoadOptions();
    **Document doc = new Document(in, htmlOptions);**. // where the code throws the exception
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    PdfSaveOptions options = new PdfSaveOptions();
    doc.save(out, options);
    return out;


When a required font is not found in the system, the API finds other suitable fonts that can be substituted. That is why we always recommend to install all Microsoft Fonts in the non-Windows environment. The Package with Microsoft compatible fonts: ttf-mscorefonts-installer . (e.g. sudo apt-get install ttf-mscorefonts-installer ) should be installed and these fonts should be placed in “/usr/share/fonts/truetype/msttcorefonts” directory as Aspose.PDF scans this folder on Linux like operating systems.

Furthermore, please share some more details like source HTML file and environment details of both systems i.e. working and not working so that we may further proceed to investigate the issue accordingly.


Are those licensed fonts in ttf-mscorefonts-installer or are they free substitutes?


No, installing this package would not include those fonts which are requiring license in the system. However, API would have some substitutes to replace such fonts with suitable Microsoft Fonts while creating the PDF. This could help preventing the issue that you are facing at the moment.