Inserting image with hyperlink in pptx

Can we inset image in pptx file with some hyperlink, so that if user click on image it will redirect the user to the new window.

Hi,


Thanks for inquiring Aspose.Slides.

I have observed the requirements shared by you and request you to please try using following sample code to serve the purpose on your end.

public static void testImageHyperlink()
{
//Instantiate Prseetation class that represents the PPTX
Presentation pres = new Presentation();

//Get the first slide
ISlide sld = pres.getSlides().get_Item(0);
//Instantiate the Image class
IPPImage imgx =null;

try{
imgx = pres.getImages().addImage(new FileInputStream(new File(“asp.jpg”)));
}
catch(IOException e){}

//Add Picture Frame with height and width equivalent of Picture
IPictureFrame picFrm=sld.getShapes().addPictureFrame(ShapeType.Rectangle, 50, 150, imgx.getWidth(), imgx.getHeight(), imgx);
//Write the PPTX file to disk

//Set Hyperlink for the image
IHyperlinkManager HypMan = picFrm.getHyperlinkManager();
HypMan.setExternalHyperlinkClick(“http://www.aspose.com”);
pres.save(“RectPicFrame.pptx”, SaveFormat.Pptx);

}

I hope this will be helpful. Please share, if I may help you further in this regard.

Many Thanks,