Why doesn't the Aspose.C++ work without the ms fonts installed in the linux where as Aspose.Java can work?

Hi,

I am working on an application that converts pdf documents to html formats. Till now I have been using Aspose.PDF-Java (v20.5) and it works well in both windows and linux without the need to install ms fonts in linux. Now I want to use Aspose.C++ (latest version 24.12) but for linux, it requires me to install ttf-mscorefonts-installer which gets ms fonts into linux environment. If it is not installed, it straight away gives FontNotFound Exception. If Java based product was able to make font substitution automatically, why is it not happening for the C++ library.

Is there any way to make the C++ Aspose work without the need of installing msfonts ?

terminate called after throwing an instance of 'System::ExceptionWrapper<Aspose::Pdf::Details_FontNotFoundException>'
  what():  Aspose::Pdf::FontNotFoundException: Font C059 was not found

@vibhesh.patneedi

Can you please clarify if you are looking for a workaround to avoid installing MS fonts or if you want to understand the differences in font handling between Aspose.C++ and Aspose.Java?

I am looking for both. If I know what are the differences and the available workarounds, I can work on a solution for my use case.

@vibhesh.patneedi

We are checking it and will get back to you with details soon.

@vibhesh.patneedi
To install ttf-mscorefonts-installer please use the following commands:

sudo apt install ttf-mscorefonts-installer
sudo fc-cache -f -v

What about differences in font handling between Aspose.C++ and Aspose.Java this is a more complex question. To give you an exact answer, I need more information. Could you provide me with the pdf file and an example of your code where the exception is thrown?.

Aspose.C++ (24.12)
Compiler: clang version 18.1.8 (RESF 18.1.8-3.el9)
(Rocky Linux 9, Ms-fonts are not installed )

    String infilename("../resume.pdf");
    String outfilename("PDFToHTML.html");
    
    auto document = MakeObject<Document>(infilename);
    auto htmlOptions = MakeObject<HtmlSaveOptions>();
    document->Save(outfilename, htmlOptions);

The pdf used:
resume.pdf (134.0 KB)

Result

terminate called after throwing an instance of 'System::ExceptionWrapper<Aspose::Pdf::Details_FontNotFoundException>'
  what():  Aspose::Pdf::FontNotFoundException: Font C059 was not found

I understand that ttf-mscorefonts-installer must be downloaded for aspose.cpp in linux. If I install it, there was no exception and the pdf to html conversion works fine.

But the mscorefonts package comes with license terms that do not allow me to include them in my software package that i am going to distribute for comercial purpose.

So I think that there must be some workaround to achieve this since the Aspose.Java (20.5) was working like that and i have been using it for long time.

Aspose.Java (20.5)
Rocky linux 9 (MS Fonts not installed)
Compiler: javac 17.0.13

   Document pdfDocument = new Document("resume.pdf");
   HtmlSaveOptions saveOptions = new HtmlSaveOptions();

   pdfDocument.save("output_out.html", saveOptions);

This works fine and pdf gets converted to html (though ms fonts are not installed)

What exactly I am looking for:
How can i make the Aspose.C++ work in linux environment without installing the msfonts ?

PS: I am trying to distribute my application as a docker image and ms fonts need to be included in that docker image which violates the license agreement of ttf-mscorefonts-installer. Also, I cannot ask my users to download the fonts themselves after deploying the docker images due to some technical complications. So that is the reason I am looking for the solution that avoids the need for installing ms fonts. I tried using liberation fonts, dejavu fonts etc but the font substitution does not happen like it does in the Java based aspose.pdf

@vibhesh.patneedi
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFCPP-3128

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@vibhesh.patneedi
I understand. Please give me some time to work on your question. I’ve already planned the corresponding task.

@vibhesh.patneedi The issue is resolved in the latest version Aspose.PDF for C++ 25.1 Linux. The library works without the ttf-mscorefonts-installer package installed now.