How to Add Hyperlink to an Image in PowerPoint using Java

This simple topic focuses on how to add Hyperlink to an Image in PowerPoint using Java by providing the step wise details to configure the environment and use the sample code. You can easily create Hyperlink for an Image in PPTX using Java use this application in any operating system environment configured with Java including Windows, macOS, or Linux with the help of simple API calls.

  1. Configure Aspose.Slides from the Maven repository to insert a hyperlink in the presentation
  2. Instantiate the Presentation class object to add an empty Presentation object
  3. Access the first slide in the presentation slides collection
  4. Load the source PNG image from the disk and add it to the presentation image collection
  5. Insert the added image to a picture frame inside the selected slide shapes collection
  6. Add a hyperlink to an external slide for the picture frame shape using the Hyperlink class and set its properties
  7. Save the presentation with a hyperlink as PPTX on the disk

The above steps guide to insert hyperlink to an image in PPTX using Java where after creating a default empty presentation using the Presentation class, we will access its default first slide from the slides collection. You can load any image format including JPEG, PNG, GIF, BMP or TIFF from the disk and add it to the presentation image collection. Finally, the added image is associated with a picture frame inside the slide and an external hyperlink is set to that along with its respective properties before saving the presentation on the disk.

The above example insert hyperlink to an image in PPTX in Java using the simple API interface. You can add a hyperlink to any shape inside the presentation including autoshapes, video frames and table cells. While inserting the hyperlink using the Hyperlink class for any shape, you can set different properties for the added hyperlink including a tooltip text, highlight click, color source and history. In the given code, we have set an external hyperlink but you can also set the internal hyperlinks to navigate between different slides of the presentation as well.

In this example, we have learnt to insert hyperlink to an image inside PPTX, however you can use the same code to add hyperlink to an image in PPT using Java. If you are interested in learning to convert PDF to a PowerPoint presentation, refer to the article on how to convert PDF to Presentation using Java.

 English