إنشاء شريحة كصورة SVG
Contents
[
Hide
]
لإنشاء صورة SVG من أي شريحة مرغوبة باستخدام Aspose.Slides.Pptx لـ .NET، يرجى اتباع الخطوات أدناه:
- إنشاء مثال من فئة Presentation.
- الحصول على مرجع الشريحة المطلوبة باستخدام معرفها (ID) أو الفهرس.
- الحصول على صورة SVG في تدفق الذاكرة.
- حفظ تدفق الذاكرة إلى ملف.
مثال
//Instantiate a Presentation class that represents the presentation file
using (Presentation pres = new Presentation("Slides Test Presentation.pptx"))
{
//Access the second slide
ISlide sld = pres.Slides[1];
//Create a memory stream object
MemoryStream SvgStream = new MemoryStream();
//Generate SVG image of slide and save in memory stream
sld.WriteAsSvg(SvgStream);
SvgStream.Position = 0;
//Save memory stream to file
using (Stream fileStream = System.IO.File.OpenWrite("PresentatoinTemplate.svg"))
{
byte[] buffer = new byte[8 * 1024];
int len;
while ((len = SvgStream.Read(buffer, 0, buffer.Length)) > 0)
{
fileStream.Write(buffer, 0, len);
}
}
SvgStream.Close();
تحميل المثال التشغيلي
تحميل عينة الكود
لمزيد من التفاصيل، زر Render Presentation Slides as SVG Images in .NET.