
Aspose.Slides for Python via .NET
Python API to Create & Convert PowerPoint Presentations
A PowerPoint Python API for PPT/PPTX presentation creation, editing, spliting, merging, & conversion without using Microsoft Office PowerPoint.
What is Aspose.Slides for Python via .NET?
Aspose.Slides for Python via .NET is a robust Python PowerPoint API that empowers developers to programmatically create PowerPoint presentations, modify slides, and render or export files using Python. By leveraging .NET capabilities within Python, it enables full control over PowerPoint presentations without the need for Microsoft Office. Whether you're working on Windows, Linux, or macOS, this versatile library allows developers to render PPT/PPTX files, read and write various formats including PPT, PPTX, POT, PPSX, and ODP with ease. It's a powerful solution for developers needing cross-platform support for PowerPoint automation.
This high-performance open source Python PPTX API supports advanced and essential features such as slide creation, layout customization, and media insertion like audio or video. Developers can effortlessly convert PowerPoint files Python to formats like PDF, XPS, SVG, HTML, or popular image types (JPEG, PNG, GIF). With capabilities to manage shapes, text styling, slide transitions, and alignment, the API simplifies the process of managing PowerPoint presentations Python-based apps. Whether generating reports, business decks, or dynamic slideshows, Aspose.Slides offers a flexible, scalable way to manage PowerPoint presentations in Python effectively.
Getting Started with Aspose.Slides for Python via .NET
The recommend way to install Aspose.Slides for Python via .NET is using pip. Please use the following command for a smooth installation.
Install Aspose.Slides for Python via .NET via pip
pip install aspose.slides
You can also download it directly from Aspose product release page.PowerPoint Presentation Generation via Python
Aspose.Slides for Python via .NET is a very useful solution for creating and managing PowerPoint presentations inside their own Python applications. The library has included several important features for handling presentations such as add slides to existing presentations, examine presentation, merge multiple presentations, insert images inside presentations, insert notes to presentations, merge specific slides from presentations, merge slides to presentation section, convert presentation to PDF and many more.
How to Merge Presentations via Python API?
import aspose.slides as slides
with slides.Presentation("pres.pptx") as pres1:
with slides.Presentation("Presentation1.pptx") as pres2:
for slide in pres2.slides:
pres1.slides.add_clone(slide)
pres1.save("combined.pptx", slides.export.SaveFormat.PPTX)
Add & Manage Slides in Presentations via Python API
Aspose.Slides for Python via .NET has included complete support for handling slides inside PowerPoint presentation using Python commands. Software developers can perform various operations for managing slides inside their PowerPoint presentations, such as adding slides to presentation, access slide in presentation, delete unwanted slides from the presentation, clone slides, compare slides, adjust slide layout, convert slides to image file formats, convert slides with custom sizes, set slide masters, copy slide contents, add slide transition, set transition effects and many more.
How to Create Simple Slide Transition effect via python API?
import aspose.slides as slides
# Instantiate Presentation class to load the source presentation file
with slides.Presentation(path + "AccessSlides.pptx") as presentation:
# Apply circle type transition on slide 1
presentation.slides[0].slide_show_transition.type = slides.slideshow.TransitionType.CIRCLE
# Apply comb type transition on slide 2
presentation.slides[1].slide_show_transition.type = slides.slideshow.TransitionType.COMB
# Write the presentation to disk
presentation.save("SampleTransition_out.pptx", slides.export.SaveFormat.PPTX)
Add Comments to Presentations in Python Apps
Comments are very useful part of the presentations that helps users to provide feedback or communicate with their teammates when review presentations. Aspose.Slides for Python via .NET has provided complete support for adding and managing comments on presentations inside Python applications. The library has included various features for handling presentations, such as adding comments to a slide in a PowerPoint presentation, access an existing comment on a slide, reply to comments, add a modern comment to a slide, delete all comments and authors, delete specific comments on a slide and many more.
How to Delete Specific Comments on a Slide via Python API?
import aspose.pydrawing as draw
import aspose.slides as slides
from datetime import date
with slides.Presentation() as presentation:
slide = presentation.slides[0]
# add comments...
author = presentation.comment_authors.add_author("Author", "A")
author.comments.add_comment("comment 1", slide, draw.PointF(0.2, 0.2), date.today())
author.comments.add_comment("comment 2", slide, draw.PointF(0.3, 0.2), date.today())
# remove all comments that contain "comment 1" text
for commentAuthor in presentation.comment_authors:
toRemove = []
for comment in slide.get_slide_comments(commentAuthor):
if comment.text == "comment 1":
toRemove.append(comment)
for comment in toRemove:
commentAuthor.comments.remove(comment)
presentation.save("pres.pptx", slides.export.SaveFormat.PPTX)
Work With Hyperlinks in Presentations via Python API
Aspose.Slides for Python via .NET has provided some useful features for handling hyperlinks inside PowerPoint presentations using Python API. The library allows software developers to add URL hyperlinks to texts, adding URL hyperlinks to shapes or frames, adding URL hyperlinks to media files, formatting hyperlinks, using hyperlinks to create table of contents, mutable hyperlink, supported properties in IHyperlinkQueries and many more. The following example demonstrates how to add a website hyperlink to a text using Python code.
How to Add a Website Hyperlink to a Text via Python API?
import aspose.slides as slides
with slides.Presentation() as presentation:
shape1 = presentation.slides[0].shapes.add_auto_shape(slides.ShapeType.RECTANGLE, 100, 100, 600, 50, False)
shape1.add_text_frame("Aspose: File Format APIs")
shape1.text_frame.paragraphs[0].portions[0].portion_format.hyperlink_click = slides.Hyperlink("https://www.aspose.com/")
shape1.text_frame.paragraphs[0].portions[0].portion_format.hyperlink_click.tooltip = "More than 70% Fortune 100 companies trust Aspose APIs"
shape1.text_frame.paragraphs[0].portions[0].portion_format.font_height = 32
presentation.save("presentation-out.pptx", slides.export.SaveFormat.PPTX)