عرض الشريحة كصورة مصغرة بصيغة JPEG باستخدام قيم محددة من المستخدم
Contents
[
Hide
]
لإنشاء مصغّر لأي شريحة مرغوبة باستخدام Aspose.Slides for .NET:
- إنشاء كائن من الفئة Presentation.
- الحصول على مرجع أي شريحة مرغوبة باستخدام معرفها أو فهرستها.
- الحصول على عوامل مقياس X و Y بناءً على الأبعاد X و Y المحددة من قبل المستخدم.
- الحصول على صورة المصغّر للشريحة المرجعية بمقياس محدد.
- حفظ صورة المصغّر بأي تنسيق صورة مرغوب.
string filePath = @"..\..\..\Sample Files\";
string srcFileName = filePath + "User Defined Thumbnail.pptx";
string destFileName = filePath + "User Defined Thumbnail.jpg";
//Instantiate the 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
using (IImage image = sld.GetImage(scaleX, scaleY))
{
//Save the image to disk in JPEG format
image.Save(destFileName, ImageFormat.Jpeg);
}
}