Using Aspose Slides for Java 17.9.1 and running on Redhat.
We have a Powerpoint conversion process which will load an existing PPT or PPTX files, remove certain features (actions / macros) and then save the presentation in the same format.
The server has no fonts installed. This does not seem to be a problem for PPT files but throws an exception when saving a PPTX file.
Presentation presentation = new Presentation(in);
presentation.save(out, SaveFormat.Pptx);
When I try and save a PPTX I get the following:
Caused by: class com.aspose.slides.exceptions.InvalidOperationException: Cannot find any fonts installed on the system.
com.aspose.slides.internal.e8.else.do(Unknown Source)
com.aspose.slides.internal.e8.else.do(Unknown Source)
com.aspose.slides.internal.e8.else.do(Unknown Source)
com.aspose.slides.s3.do(Unknown Source)
com.aspose.slides.sq.<init>(Unknown Source)
com.aspose.slides.s3.if(Unknown Source)
com.aspose.slides.s3.do(Unknown Source)
com.aspose.slides.a2w.int(Unknown Source)
com.aspose.slides.a2w.extends(Unknown Source)
com.aspose.slides.a1o.do(Unknown Source)
com.aspose.slides.a1o.do(Unknown Source)
com.aspose.slides.a1o.<init>(Unknown Source)
com.aspose.slides.TextFrame.do(Unknown Source)
com.aspose.slides.TextFrame.do(Unknown Source)
com.aspose.slides.TextFrame.else(Unknown Source)
com.aspose.slides.ah.do(Unknown Source)
com.aspose.slides.vp.do(Unknown Source)
com.aspose.slides.vp.do(Unknown Source)
com.aspose.slides.b1.do(Unknown Source)
com.aspose.slides.avn.do(Unknown Source)
com.aspose.slides.apv.do(Unknown Source)
com.aspose.slides.apv.do(Unknown Source)
com.aspose.slides.Presentation.do(Unknown Source)
com.aspose.slides.Presentation.do(Unknown Source)
com.aspose.slides.Presentation.if(Unknown Source)
com.aspose.slides.Presentation.save(Unknown Source)
In an attempt to resolve this issue, I have tried:
-
Using the FontsLoader.loadExternalFont(byte[]) method to add a single ttf file - this made no difference.
-
Using the FontsLoader.loadExternalFonts(String[]) method to add the path to the folder containing the same ttf file - this solved the problem.
It seems like saving a presentation with SaveFormat.PPTX will fail unless there is at least one font file loaded from a folder.
Saving to PPT format works fine with no fonts loaded.
I have tried using the Aspose slides 17.8, 17.9, 17.9.1 and 17.12.1 libraries, based on various discussions on these forums. All have the same result.
Can you please advise why the behaviour is different between saving as PPT and saving as PPTX. Also, what is the correct approach?
Thanks for your help.