How to add image to last side of the ppt?

How we add the image to a particular slide example
to last slide of the ppt
or to the 3 rd slide of the ppt

1 Reply 1 reply marked as answer

MR Manikandan Ravichandran Syncfusion Team September 15, 2020 06:42 PM UTC

Hi Kiran,

Thank you for contacting Syncfusion support.

Please find the code example from below to add the image in the last slide or required slide of the Presentation document
 
/// <summary>
///
Add a image into PowerPoint document.
/// </summary>
private static void AddImage()
{
    
//Creates a instance of Presentation
     IPresentation pptxDoc = Presentation.Open(@"Input.pptx");
    
//Gets a picture as stream.
     Stream pictureStream = File.Open(@"Image.png", FileMode.Open);
    
//Insert a image into last PowerPoint slide.
     InsertImage(pptxDoc, pictureStream, pptxDoc.Slides.Count - 1);
    
//Insert a image into third PowerPoint slide.
     InsertImage(pptxDoc, pictureStream, 2);
    
//Saves the Presentation to the file system.
     pptxDoc.Save("Output.pptx");
    
//Dispose the image stream
     pictureStream.Dispose();
   
//Closes the Presentation
    pptxDoc.Close();
}
/// <summary>
///
Insert a image into specified PowerPoint slide index.
/// </summary>
///
<param name="pptxDoc">Represent a PowerPoint document to insert.</param>
///
<param name="pictureStream">Represent a input picture stream to insert.</param>
///
<param name="slideIndex">Represent a slide index to insert.</param>
private static void InsertImage(IPresentation pptxDoc, Stream pictureStream, int slideIndex)
{
   
//Gets a slide instance of specified index.
    ISlide slide = pptxDoc.Slides[slideIndex];
   
//Adds the picture to a slide by specifying its size and position.
    IPicture picture = slide.Pictures.AddPicture(pictureStream, 0, 0, 250, 250);
}
 

Please let us know if you have any questions.

Regards,
Manikandan Ravichandran
 


Marked as answer
Loader.
Up arrow icon