Convert Powerpoint file into Image file

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