Frequently Asked Questions
Frequently Asked Questions
How do I install Aspose.Slides FOSS?
Install from PyPI using pip. Python 3.10 or later is required.
pip install aspose-slides-fossVerify the installation:
import aspose.slides_foss as slides
with slides.Presentation() as prs:
print(f"Slides: {len(prs.slides)}")The lxml dependency is installed automatically. No Microsoft Office or other system runtime is required.
Why must I use with slides.Presentation() as prs:?
The Presentation class manages internal file handles and XML resources. Without the context manager, those resources are not released when the Presentation object goes out of scope, which can cause resource leaks or file locks on Windows.
Always follow this pattern:
with slides.Presentation("input.pptx") as prs:
# work here
prs.save("output.pptx", SaveFormat.PPTX)What file formats can I save to?
The SaveFormat enum defines constants for many formats — PPTX, PDF, HTML, SVG, JPEG, PNG, and others — for API compatibility with the commercial edition. At runtime in this FOSS edition, all save() calls ignore the format argument and always write PPTX output. Passing SaveFormat.PDF compiles and runs without error but produces a .pptx file, not a .pdf.
from aspose.slides_foss.export import SaveFormat
prs.save("output.pptx", SaveFormat.PPTX)Export to non-PPTX formats is not functionally available in this edition. Use SaveFormat.PPTX for all save operations.
Can I open .ppt (old PowerPoint 97–2003) files?
No. Only .pptx (Office Open XML) files are supported. Legacy .ppt binary format is not handled by this library.
How do I access slides?
Slides are a zero-based list accessible via prs.slides:
first_slide = prs.slides[0]
slide_count = len(prs.slides)How do I add a second slide?
Use prs.slides.add_empty_slide() with a layout:
with slides.Presentation() as prs:
layout = prs.layout_slides[0]
prs.slides.add_empty_slide(layout)
slide2 = prs.slides[1]
prs.save("two-slides.pptx", SaveFormat.PPTX)How do I set the slide background color?
Slide background coloring is not available in this edition. The Slide class does not expose a background property. Attempting slide.background will raise AttributeError. This feature is not implemented in the current version.
How do I use NullableBool?
NullableBool is a tri-state enum used for formatting properties. Use NullableBool.TRUE (not Python’s True) for bold, italic, and similar properties:
from aspose.slides_foss import NullableBool, TextUnderlineType
fmt.font_bold = NullableBool.TRUE
fmt.font_italic = NullableBool.FALSE
# font_underline is TextUnderlineType, not NullableBool:
fmt.font_underline = TextUnderlineType.NOT_DEFINED # inherits from themeWhy does setting text color have no effect?
You must also set fill_type = FillType.SOLID before assigning the color:
from aspose.slides_foss import FillType
from aspose.slides_foss.drawing import Color
fmt.fill_format.fill_type = FillType.SOLID
fmt.fill_format.solid_fill_color.color = Color.from_argb(255, 200, 0, 0)Can I use charts or SmartArt?
No. Charts, SmartArt, OLE objects, animations, transitions, hyperlinks, VBA macros, and digital signatures are not implemented in this edition and raise NotImplementedError.
Does the library support Python 3.9?
No. Python 3.10 or later is required.
Is this library thread-safe?
Each Presentation object is independent. Creating and using separate Presentation instances from separate threads is safe as long as you do not share a single Presentation object across threads without external locking.
How do I embed an image?
Read the image bytes and add them to prs.images, then create a PictureFrame:
with open("logo.png", "rb") as f:
image_data = f.read()
image = prs.images.add_image(image_data)
slide.shapes.add_picture_frame(slides.ShapeType.RECTANGLE, 50, 50, 200, 150, image)