I’m trying to convert an existing powerpoint to a new powerpoint that contains only a image of the original powerpoint. I read that as of now you dont have a way to add a new slide to a powerpoint (is the enterprise version available yet?)
I would be ok with replacing the current slide with an image or adding an image to a new powerpoint and slide - Below is what I have - Thanks for your help.
Aspose.PowerPoint.Presentation pres1 = new Presentation( templatePath );
Aspose.PowerPoint.Presentation pres2 = new Presentation( Server.MapPath(“UploadDir”) +"\testReadonly.ppt" );
System.Drawing.Imaging.EncoderParameters encoderParams = new System.Drawing.Imaging.EncoderParameters();
System.Drawing.Imaging.EncoderParameter encoderParam = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality,“0”);
encoderParams.Param[0] = encoderParam;
SortedList temp = new SortedList();
int picid=0;
for (int i = 1; i < pres1.Slides.Count; i++)
{
Slide slide = pres2.GetSlideByPosition(i);
if (slide != null)
pres2.CloneSlide(slide, pres1.Slides.LastSlidePosition + 1, pres1, temp);
string fname = String.FormatServer.MapPath(“UploadDir”) +“thumb”+ i +".png" );
pres1.Slides.GetThumbnail(1, 1).Save(fname);
picid = pres2.Pictures.Add(new Picture(pres1, fname));
// pres.CloneSlide(pres1.Slides[0],pres1.Slides.LastSlidePosition + 1,pres1,new SortedList());
pres1.Slides.Background.PictureId =picid;
GC.Collect();
}
pres2.Write(Server.MapPath(“UploadDir”) + “testReadonly.ppt”);