1. using Microsoft.Office.Interop.PowerPoint;
  2. using Microsoft.Office.Core;
  3. using System.IO;
  4. try
  5. {
  6. FileInfo objfile = new FileInfo(FileUpload1.PostedFile.FileName);
  7. if (objfile.Extension.Equals(".ppt"))
  8. {
  9. ApplicationClass pptApplication = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();
  10. Presentation pptPresentation = pptApplication.Presentations.Open(objfile.FullName, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
  11. pptPresentation.Export(objfile.FullName, "jpg", Int32.Parse(pptPresentation.SlideMaster.Width.ToString()), Int32.Parse(pptPresentation.SlideMaster.Height.ToString()));
  12. }
  13. else
  14. {
  15. Response.Write("Please choose PowerPoint files only");
  16. }
  17. }
  18. catch (Exception ex)
  19. { }