Disable system font folder access to users (Java)

Hello,
I run aspose slides in a spring boot app within a cloud runtime (SAP Cloud Neo).

There slides try to access the system fonts and failed.
Caused by: java.io.FileNotFoundException: /etc/fonts/conf.d/69-unifont.conf (Permission denied)

I load own fonts from ressources but the system try to access the system fonts and failed.
File file = new ClassPathResource(“fonts/”).getFile();
FontsLoader.clearCache();
String fontPath = file.getPath();
String[] fontDir = new String[] { fontPath };
log.error(fontPath);
FontsLoader.loadExternalFonts(fontDir);
Is it possible to disable the system fonts or someone any other solution ?

Regards
Gerald

@ederg,

I have observed your requirements and like to share that the issue that is incurring on your end is permission related and in fact not related to Aspose.Slides. The API is able to load installed fonts or you can copy fonts in some folder (that has permission for access) and load them externally.

Hi Aspose Team,

we are currently evaluating the usage of Aspose Slides Java lib in one of our projects.

We are running a Java application on SAP Cloud Platform / SAP Business Technology Platform. With this we “own” only the application layer but cannot easily change settings on operation level. In the past we already used successfully Apache POI and PDFBox. For those libraries we are able to add fonts during Java application startup via GraphicsEnvironment.

We tried to add our fonts manually, but seems that the Aspose lib is always trying to read the OS font data, and because of missing file access to font config files, always an exception is thrown during the Aspose “save” operation.

Our code itself (at least for the Aspose part) is very simple. We have a PowerPoint file as input stream and want to convert it into a PDF…

//create presentation based on input stream
Presentation pres = new Presentation(bInput, lo);

pres.save(bOutput, SaveFormat.Pdf);

“pres.save” is always failing with the same/similar exception already mentioned in the first entry of this thread. This even happens for black PowerPoint files, so does not really seems to be related to individual fonts used within a presentation…


caused by: com.aspose.slides.exceptions.FileNotFoundException: File not found File: /etc/fonts/conf.d/61-wine-aliases.conf
File name: ‘/etc/fonts/conf.d/61-wine-aliases.conf’ —> /etc/fonts/conf.d/61-wine-aliases.conf (Permission denied)
com.aspose.slides.internal.lh.int.(Unknown Source)
com.aspose.slides.internal.lh.int.(Unknown Source)
com.aspose.slides.internal.lh.int.(Unknown Source)
com.aspose.slides.internal.fs.long.(Unknown Source)
com.aspose.slides.internal.fs.long.(Unknown Source)
com.aspose.slides.internal.fs.long.(Unknown Source)
com.aspose.slides.internal.fs.try.int(Unknown Source)
com.aspose.slides.internal.fs.super.(Unknown Source)
com.aspose.slides.internal.fs.super.(Unknown Source)
com.aspose.slides.internal.mu.if.for(Unknown Source)
com.aspose.slides.internal.mu.if.do(Unknown Source)
com.aspose.slides.internal.mu.if.do(Unknown Source)
com.aspose.slides.internal.hj.int.int(Unknown Source)
com.aspose.slides.internal.hj.int.do(Unknown Source)
com.aspose.slides.internal.fm.this.(Unknown Source)
com.aspose.slides.internal.hj.for.if(Unknown Source)
com.aspose.slides.internal.fm.long.(Unknown Source)
com.aspose.slides.internal.fm.long.do(Unknown Source)
com.aspose.slides.internal.oq.boolean.do(Unknown Source)
com.aspose.slides.pg.do(Unknown Source)
com.aspose.slides.ov.do(Unknown Source)
com.aspose.slides.an3.do(Unknown Source)
com.aspose.slides.ov.do(Unknown Source)
com.aspose.slides.l1.do(Unknown Source)
com.aspose.slides.pm.do(Unknown Source)
com.aspose.slides.aps.int(Unknown Source)
com.aspose.slides.aps.boolean(Unknown Source)
com.aspose.slides.app.do(Unknown Source)
com.aspose.slides.app.(Unknown Source)
com.aspose.slides.TextFrame.do(Unknown Source)
com.aspose.slides.TextFrame.do(Unknown Source)
com.aspose.slides.TextFrame.do(Unknown Source)
com.aspose.slides.AutoShape.do(Unknown Source)
com.aspose.slides.GroupShape.do(Unknown Source)
com.aspose.slides.Slide.for(Unknown Source)
com.aspose.slides.Slide.do(Unknown Source)
com.aspose.slides.Slide.do(Unknown Source)
com.aspose.slides.Slide.do(Unknown Source)
com.aspose.slides.agj.do(Unknown Source)
com.aspose.slides.agj.do(Unknown Source)
com.aspose.slides.Presentation.do(Unknown Source)
com.aspose.slides.Presentation.save(Unknown Source)

For us this is a showstopper, personally I do not understand why Aspose requires access to OS font config files. Is there any way meanwhile to avoid this error and get a produced PDF file?

Thanks and regards

@mhoauto,
Welcome to our community! Thank you for the issue description. I have logged the issue in our tracking system with ID SLIDESJAVA-38510. Our development team will investigate it. I will inform you about any progress.

The issues you have found earlier (filed as SLIDESJAVA-38510) have been fixed in this update.

Thanks so much! really nice.

It does work now without issues and I am able to generate PDFs with this new version (21.4).