Hello everyone,
I’m currently exploring Aspose and encountering an issue.
When I try to convert a slide to a JPG image using Aspose, any shape containing a mathematical formula (MathPortion) disappears.
Here is my code:
blob_name = self.slides[slide_id]["pptx_file_path"]
pres = slides.Presentation(io.BytesIO(self.file_saver.read_bytes(blob_name)))
slide = pres.slides[0]
with slide.get_image(draw.Size(1400, 700)) as thumbnail:
image_buffer = io.BytesIO()
thumbnail.save(image_buffer, slides.ImageFormat.JPEG)
image_buffer.seek(0)
blob_name = f"{self.id}/{slide_id}/slide.jpg"
self.file_saver.save_bytes(blob_name=blob_name, data=image_buffer)
When I remove the mathematical formula from the slide, this code works perfectly.
Has anyone else faced the same issue?
Any help would be greatly appreciated!
Thanks in advance,
Jules
@juleskln,
Thank you for contacting free support.
We are sorry that you encountered this problem. We need more details to investigate the case. Please share the following files and information:
- sample presentation file
- output image file
- version of Aspose.Slides you are using
I’m working on an app with Aspose in order to modify slides contents.
Input file : image (3).jpg (100,5 Ko)
The render works perfectly.
Output file :
- PPTX : image.png (27,1 Ko)
The render works perfectly.
- JPG : image (4).png (57,0 Ko)
As you can see, it doesn’t work here. And if I remove the mathematical equation, the text remains in the image, but with the mathematical equation, I got nothing left.
Do I miss something ?
I’m using Aspose.Slides==25.2.0
Thanks!
@juleskln,
Thank you for the additional information. We would greatly appreciate it if you could share the PPTX file you used. You can zip the file and upload the archive here.
Sorry, here it is ! formule.zip (883,2 Ko)
@juleskln,
Unfortunately, I was unable to reproduce the issue you encountered. Please share the following additional information:
- OS version on which the code was executed
- Python version you are using
I’m sorry for the confusion.
Here is the PPT file, which does not render the formula cell when I’m using the get_image function :
slide.zip (875,6 Ko)
I’m using Python 3.12, on Ubuntu
As you can see on the thumbnail on Windows, we can’t see the mathematic formula inside the box, but when we open the PowerPoint file, it appears. It seems the box is hidden when we convert to JPEG
Capture d’écran 2025-04-29 102209.png (13,0 Ko)
@juleskln,
Thank you for the details. The text disappears because the Cambria Math font is missing on the operating system where the PPTX-to-JPG conversion was performed. You should install the font on the operating system or use the FontsLoader class to load it as an external font, as shown below:
FontsLoader.loadExternalFonts(new String[]{"path_to_fonts"});
Custom PowerPoint Font in Java|Aspose.Slides Documentation
Some fonts used in the presentation may be substituted with other fonts if they are also missing. You can check whether any fonts will be substituted this way:
with slides.Presentation("slide.pptx") as presentation:
font_substitutions = presentation.fonts_manager.get_substitutions()
for font_substitution in font_substitutions:
print(font_substitution.original_font_name + "->" +
font_substitution.substituted_font_name)