We have requirement to convert uploaded PPT or PPTX files into image files. We developed this working locally with following (POC code):
Application pptAppli
Here's the narrowed down solution which worked on all the servers, i'm posting this solution after 7 months mature research.
That's it and i was able to convert slides into images.
Source Code
In case you are interested in code that I was using:
Application pptApplication = new Application();
Microsoft.Office.Interop.PowerPoint.Presentation pptPresentation = pptApplication.Presentations.Open2007(Server.MapPath("~/tempslides/pptfilename.pptx"), MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
List files = new List();
for (int i = 1; i <= pptPresentation.Slides.Count; i++)
{
pptPresentation.SaveCopyAs(serverPath + randomId, PpSaveAsFileType.ppSaveAsPNG, MsoTriState.msoTrue);
files.Add(Server.MapPath("~/tempslides") + "/slide" + i + ".PNG");
}
pptPresentation.Close();
To run above code, you need to add reference to interop lib in your project.
Hope this helps you to save your time.