public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Slides_Presentations_Thumbnail(); // Instantiate a Presentation class that represents the presentation file using (Presentation pres = new Presentation(dataDir + "ThumbnailWithUserDefinedDimensions.pptx")) { // Access the first slide ISlide sld = pres.Slides[0]; // User defined dimension int desiredX = 1200; int desiredY = 800; // Getting scaled value of X and Y float ScaleX = (float)(1.0 / pres.SlideSize.Size.Width) * desiredX; float ScaleY = (float)(1.0 / pres.SlideSize.Size.Height) * desiredY; // Create a full scale image Bitmap bmp = sld.GetThumbnail(ScaleX, ScaleY); // Save the image to disk in JPEG format bmp.Save(dataDir + "Thumbnail2_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); } }
static void Main(string[] args) { string FilePath = @"..\..\..\Sample Files\"; string srcFileName = FilePath + "User Defined Thumbnail.pptx"; string destFileName = FilePath + "User Defined Thumbnail.jpg"; //Instantiate a Presentation class that represents the presentation file using (Presentation pres = new Presentation(srcFileName)) { //Access the first slide ISlide sld = pres.Slides[0]; //User defined dimension int desiredX = 1200; int desiredY = 800; //Getting scaled value of X and Y float ScaleX = (float)(1.0 / pres.SlideSize.Size.Width) * desiredX; float ScaleY = (float)(1.0 / pres.SlideSize.Size.Height) * desiredY; //Create a full scale image Bitmap bmp = sld.GetThumbnail(ScaleX, ScaleY); //Save the image to disk in JPEG format bmp.Save(destFileName, System.Drawing.Imaging.ImageFormat.Jpeg); } }
static void Main(string[] args) { string MyDir = @"Files\"; //Instantiate a Presentation class that represents the presentation file using (Presentation pres = new Presentation(MyDir + "Slides Test Presentation.pptx")) { //Access the first slide ISlide sld = pres.Slides[0]; //Create a full scale image Bitmap bmp = sld.GetThumbnail(1f, 1f); //Save the image to disk in JPEG format bmp.Save(MyDir + "Test Thumbnail.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); } }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Slides_Presentations(); //Instantiate a Presentation class that represents the presentation file using (Presentation pres = new Presentation(dataDir + "ThumbnailFromSlide.pptx")) { //Access the first slide ISlide sld = pres.Slides[0]; //Create a full scale image Bitmap bmp = sld.GetThumbnail(1f, 1f); //Save the image to disk in JPEG format bmp.Save(dataDir + "Thumbnail.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); } }
static void Main(string[] args) { string FilePath = @"..\..\..\Sample Files\"; string srcFileName = FilePath + "Slide Thumbnail to JPEG.pptx"; string destFileName = FilePath + "Slide Thumbnail to JPEG.jpg"; //Instantiate a Presentation class that represents the presentation file using (Presentation pres = new Presentation(srcFileName)) { //Access the first slide ISlide sld = pres.Slides[0]; //Create a full scale image Bitmap bmp = sld.GetThumbnail(1f, 1f); //Save the image to disk in JPEG format bmp.Save(destFileName, System.Drawing.Imaging.ImageFormat.Jpeg); } }