Aspose.Slides for Python: slides.Presentation Throws a PptxReadException

hi.

import aspose.slides as slides

file_path = "test37.pptx"
slides.Presentation(file_path)

the error message is

An error occurred while creating the presentation: Proxy error(PptxReadException): Font ‘?’ cannot be found. —> ArgumentException: Font ‘?’ cannot be found.

we can not share this pptx because this is our customer’s pptx.
replacing slide master to office default solves this error.
also, deleting table object which is not power point table solves this error.
also, saving without embedding fonts solves this error too.
I still can not figure out which causes this error.
But ahh, Font '?' means Aspose.Slides for Python could not understand Japanese font name which is not English.
I think this is not ICU problem because our docker image has libicu66 library to enable .NET Core globalization.

I deleted all fontface elements from slide1.xml. But this error still happened.

What xml should I check?

thanks

@s.nakagaki

It sounds like you’re encountering a font-related issue when trying to load a PowerPoint presentation with Aspose.Slides. The error message indicates that a specific font cannot be found, which is often due to the font not being embedded in the presentation or not being available on the system where the code is running.

Cause: The issue arises when the required font is either not embedded in the presentation or is missing from the system.

Solution: Here are some steps you can take to diagnose and resolve the issue:

  1. Check Embedded Fonts: Use the get_embedded_fonts method from the FontsManager class to see which fonts are embedded in the presentation. This can help you identify if the problematic font is included.

    from aspose.slides import Presentation
    
    presentation = Presentation("test37.pptx")
    embedded_fonts = presentation.fonts_manager.get_embedded_fonts()
    for font in embedded_fonts:
        print(font.font_name)
    
  2. Font Substitution: If the font is not embedded, consider using the replace_font method to substitute the missing font with a default or available font. This can help avoid the error when loading the presentation.

    from aspose.slides import FontsManager, FontSubstRule
    
    fonts_manager = presentation.fonts_manager
    subst_rule = FontSubstRule("MissingFontName", "DefaultFontName")
    fonts_manager.replace_font(subst_rule)
    
  3. Inspect XML Files: Since you mentioned modifying the XML files, ensure that you check the pptx structure, particularly the presentation.xml and any fonts related XML files. Look for any references to the missing font and see if you can identify any discrepancies.

  4. Test with Different Fonts: If possible, try creating a simple presentation with standard fonts (like Arial or Times New Roman) and see if it loads without issues. This can help confirm if the problem is specific to certain fonts.

  5. Update Libraries: Ensure that you are using the latest version of Aspose.Slides, as updates may include fixes for font handling and other related issues.

Next Steps: If you continue to face challenges, consider reaching out to Aspose support with specific details about the fonts used in the presentation and any modifications you’ve made to the XML files.

Please let me know if you need further assistance!

@s.nakagaki,
Thank you for contacting free support. Unfortunately, it is quite difficult to determine exactly what caused this error. Could you please remove any sensitive information from the presentation you mentioned and share it? The full stack trace of the error would also be helpful.

Hi

You can download from here.

The extension is .zip, but it’s actually .pptx.
so, please change the extension from .zip to .pptx.

I think, key points are

  • embed entire fonts (not only used fonts)
  • add an image and table inside picture object (the table uses fonts and is in picture object)

thanks

@s.nakagaki,
Thank you for the sample presentation file. With Aspose.Slides for Python 25.7, I was unable to reproduce the error you decribed. Please share the following additional information:

  • the OS version on which the code was executed
  • the Python version you are using
  • the Aspose.Slides version you are using

hi

  • Python 3.12.11
  • macOS 15.5 and docker image [mcr.microsoft.com/azure-functions/python:4-python3.12 (amd64 platform)]
  • aspose-slides==25.7.0

thanks

P.S.
I tested this on Windows. It worked. I mean no error. this is non-windows problem. Are some libraries missing :<

@s.nakagaki,
Thank you for the additional information. I have reproduced the error you described. We apologize for any inconvenience caused.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESPYNET-289

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

(I hope it will be fixed sooner.)

@s.nakagaki,
Our developers will do their best to resolve the issue as soon as possible. Thank you for helping make Aspose.Slides better.