I’m trying to convert excel file to pdf file.
I’m using GroupDocs.Conversion java library v24.8, on Ubuntu 22.04.4 LTS 64-bit.
I keep getting an error: com.groupdocs.conversion.internal.c.a.pd.exceptions.FontNotFoundException: Font Arial was not found
I’m not sure if this is acceptable solution for us, cause we don’t have full control over servers where our web app would be deployed.
Is this some known issue for GroupDocs.Conversion on Ubuntu?
Is there a way to bundle fonts into the GroupDocs.Conversion java library, or to make a new dependency that’d be pulled by GroupDocs.Conversion?
ConverterSettings converterSettings = new ConverterSettings();
converterSettings.setFontDirectories(List.of("/usr/share/fonts", "/usr/share/fonts/truetype", "/usr/share/fonts/truetype/dejavu"));
Converter converter = new Converter(inputPath, converterSettings)
and I’m still getting the same error: Font Arial was not found
Even if I try substitution: FontRepository.getSubstitutions().add(new SimpleFontSubstitution("Arial", "Lato"));
the substitution itself does not throw an error, but the conversion later throws still the same error: Font Arial was not found
Also, how is it possible that GroupDocs.Viewer can convert DOC to PDF successfully, but GroupDocs.Conversion, a library that’s actually intended for conversion, fails to do the same?
Thanks for the answer, after installing windows fonts (locally), conversion starts working!
However I’m not sure if it’s suitable solution for us, cause in production environment, we don’t have full control over the server machine.
Maybe not “politically correct” question, but how does GroupDocs.Viewer handle this situation? Does it embed all needed fonts maybe? Is there some similar solution for GroupDocs.Conversion?
I’m sorry for the delayed response. You can copy fonts with your application and specify a path for the folder with fonts as it shown in the code snippet below:
ArrayList<String> fontDirectories = new ArrayList<String>();
fontDirectories.add("./fonts");
ConverterSettings settings = new ConverterSettings();
settings.setFontDirectories(fontDirectories);
Converter converter = new Converter(() -> doc, () -> settings);
GroupDocs.Viewer handles fonts in a similar way. The fonts can be installed into a system folder or copied with the application.