How to Add Hyperlink to an Image in PowerPoint using C#

This small tutorial provides information about how to add Hyperlink to an Image in PowerPoint using C# along with all the required information about the configuration, step-wise process, and a runnable sample code to create Hyperlink for an Image in PPTX using C#. The sample code exhibits a complete scenario and can be used in any of the operating systems like Windows, macOS, or Linux.

  1. Configure the environment to add Aspose.Slides for .NET into your application
  2. Create a new empty Presentation object
  3. Access the first slide in presentation slides collection
  4. Read the source PNG image as a byte array from the disk
  5. Add the image in the presentation Images collection and access that using IPPImage class object
  6. Insert a picture frame in the shapes collection of the selected slide using the added image above
  7. Add an external hyperlink for the picture frame shape using the Hyperlink class and set hyperlink properties
  8. Save the presentation as PPTX having a hyperlink for a PNG image in it

The aforementioned steps guide to insert hyperlink to an image in PPTX using C# where the process will commence by creating an empty presentation using the Presentation class and accessing the first default slide inside the slides collection of the presentation. Subsequently, a PNG image is added as a picture frame inside the selected slide, which is then followed by setting an external website hyperlink for the added image using the Hyperlink class object.

While working with this feature to insert hyperlink to an image in PPTX in C#, we have used the Slide object to hold the reference to the target slide and IPPImage object to hold the reference to the new image added inside the images collection. The Hyperlink class object is used to set the hyperlink for the added image shape by setting its properties like an external link and a tooltip text. You can also set the hyperlink to internal slides inside the presentation.

In this tutorial, we have learnt to add hyperlink to an image in PPT using C#. If you want to convert PDF to a PowerPoint presentation, refer to the article on how to convert PDF to Presentation using C#.

 English