PPTX to PDF conversion font family issue using Java

I’m getting an error that states “FontFamily ‘DejaVu Sans Mono’ not found” when I try to convert the pptx file that is in the test.zip file using version “16.10.1” of the conversion jar. It works fine if I drop back down to “3.0.0” I’ve included the list of fonts I have installed in the “fc-list.txt” file, and the full stack trace I see.


Any help or direction would be greatly appreciated.

Thanks

Nathan Mills

Hi Nathan,


Thanks for taking interest in GroupDocs.Conversion for Java 16.10.1 and posting your concerns.
Can you please share the sample code with us. We’ll appreciate your cooperation.

Kind regards

Here is some code that reproduces the problem, you will need to copy fonts into the fonts directory in order to make them available in the docker container.


It looks like it’s an environment issue, I have installed the deja vu fonts and that doesn’t solve it, but installing the entire ubuntu-desktop package seems to. I’d like to keep my docker image small, do you have any ideas about what other things I may be missing that would cause the “FontFamily ‘DejaVu Sans Mono’ not found” message?

Hi Nathanm,


We tried to reproduce same issue at our end using following code snippet:

public static String convertToPdfAsFilePath(String fileName) throws java.io.IOException {
throwUnlessFileExists(fileName);
// Instantiating the conversion handler
ConversionHandler conversionHandler = new ConversionHandler(getConfiguration());
FileInputStream fis = new FileInputStream(fileName);
PdfSaveOptions saveOption = new PdfSaveOptions();
saveOption.setOutputType(OutputType.String);
WatermarkOptions watermarkOptions = new WatermarkOptions(“Watermark text”);
watermarkOptions.setColor(Color.blue);
watermarkOptions.setFont(new Font(“DejaVu Sans Mono”, 70, 70));
watermarkOptions.setRotationAngle(45);
watermarkOptions.setTransparency(0.1);
watermarkOptions.setLeft(200);
watermarkOptions.setTop(400);
saveOption.setWatermarkOptions(watermarkOptions);
// return the path of the converted document
String convertedDocumentPath = conversionHandler. convert(fis, fileName, saveOption);
fis.close();
return convertedDocumentPath;
}

We didn’t face any exception while converting pptx document to pdf along-with watermark text in DejaVu Sans Mono font. Please find the output pdf document. Can you please share your code, specifically where you are applying font while conversion?

Best wishes

Hi Nathanm,


It looks like it’s an environment issue
Yes seems so. Because we are not able to reproduce same issue at our end.
but installing the entire ubuntu-desktop package seems to
So, installing the entire Ubuntu-desktop package resolved the issue ?

Kind regards