WriteAsSvg

WriteAsSvg(Stream)

Saves content of slide as SVG file.

public void WriteAsSvg(Stream stream)
ParameterTypeDescription
streamStreamTarget stream

Examples

The following example shows how to convert PowerPoint to PDF with custom options.

[C#]
// Presentation object can load PowerPoint formats like PPT, PPTX, ODP etc.
using (Presentation pres = new Presentation("pres.pptx"))
{
    for (var index = 0; index < pres.Slides.Count; index++)
    {
        ISlide slide = pres.Slides[index];
        using (FileStream fileStream = new FileStream($"slide-{index}.svg", FileMode.Create, FileAccess.Write))
        {
            slide.WriteAsSvg(fileStream);
        }
    }
}

See Also


WriteAsSvg(Stream, ISVGOptions)

Saves content of slide as SVG file.

public void WriteAsSvg(Stream stream, ISVGOptions svgOptions)
ParameterTypeDescription
streamStreamTarget stream
svgOptionsISVGOptionsSVG generation options

Examples

The following example code shows how to generate SVG image with Custom Shape IDS from PowerPoint Presentation.

// Instantiate a Presentation class that represents the presentation file
using (Presentation pres = new Presentation("CreateSlidesSVGImage.pptx"))
{
    // Access the first slide
    ISlide sld = pres.Slides[0];
    // 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("Aspose_out.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();
}

See Also