This crisp tutorial provides information about how to add Hyperlink to an Image in PowerPoint using Python by providing detailed configuration steps to set up the environment and use the example code. The example can be used in any of the operating systems like Windows, macOS, or Linux configured with Python to create Hyperlink for an Image in PPTX using Python.
Steps to Create Hyperlink for an Image in PPTX using C#
- Establish the IDE environment to use Aspose.Slides for Python via .NET
- Add the reference to aspose.slides namespaces in your project to insert hyperlinks in the presentation
- Instantiate a default presentation using the Presentation class and access the first default slide from the slides collection
- Read the source PNG file as a byte array from the disk and access that using the IPPImage object after inserting that inside the presentation Images collection
- Insert the picture frame inside the shapes collection of the selected slide using the added image
- Insert an external hyperlink for the picture frame shape using the Hyperlink class and set respective hyperlink properties
- Save the presentation as PPTX having a PNG image with a hyperlink inside it
The above steps guide to insert hyperlink to an image in PPTX using Python where the process involves creating a default presentation using the Presentation class instance, inserting the source image from the disk inside the presentation images collection and adding a picture frame with loaded images inside the first slide of the presentation. Finally, using the Hyperlink class, an external website hyperlink along with its respective properties will be set before saving the presentation on the disk.
Code to Insert Hyperlink to an Image in PPTX using Python
While implementing the feature to insert hyperlink to an image in PPTX in Python, the Slide object is used to hold the reference to the target slide and the IPPImage instance holds the reference to the image included in the images collection. In order to set the hyperlink for the added image different properties like an external URL link and a tooltip text are set using the Hyperlink class. One can also set the hyperlink to internal slides inside the presentation to perform navigation between them.
In this example, we have learnt to add hyperlink to an image in PPTX using Python. If you want to convert a PDF to a PowerPoint presentation, refer to the article on how to convert PDF to Presentation using Python.