This project is read-only.

Render Slide As SVG Image

Aspose.Slides for .NET is used to create presentation files, complete with slides. These slides can be viewed by opening presentations using Microsoft PowerPoint. But sometimes, developers may also need to view slides as SVG images in their favorite image viewer. In such cases, Aspose.Slides for .NET lets you export an individual slide to an SVG image.

To generate an SVG image from any desired slide with Aspose.Slides.Pptx for .NET, please follow the steps below:
  • Create an instance of the Presentation class.
  • Obtain the desired slide's reference by using its ID or index(here we are using slide index 2).
  • Get the SVG image in a memory stream.
  • Save the memory stream to file.

using (PresentationEx pres = new PresentationEx(MyDir+"Slides Test Presentation.pptx"))

                //Access the second slide
                SlideEx sld = pres.Slides[1];

                //Create a memory stream object
                MemoryStream SvgStream = new MemoryStream();

                //Generate SVG image of slide and save in memory stream
                SvgStream.Position = 0;

                //Save memory stream to file
                using (Stream fileStream = System.IO.File.OpenWrite(MyDir+ "PresentatoinTemplate.svg"))
                    byte[] buffer = new byte[8 * 1024];
                    int len;
                    while ((len = SvgStream.Read(buffer, 0, buffer.Length)) > 0)
                        fileStream.Write(buffer, 0, len);


Below is the result of code:


Last edited Mar 3, 2014 at 6:27 AM by asposemarketplace, version 4