Render a Slide as an SVG Image in C#
Overview
This article explains how to convert PowerPoint Presentation to SVG format using C#. It covers the following topics.
Format: PowerPoint
Format: PPT
Format: PPTX
Format: ODP
Format: Slide
- C# Convert PowerPoint Slide to SVG
- C# Convert PPT Slide to SVG
- C# Convert PPTX Slide to SVG
- C# Convert ODP Slide to SVG
Other topics covered by this article.
SVG Format
SVG—an acronym for Scalable Vector Graphics—is a standard graphics type or format used to render two-dimensional images. SVG stores images as vectors in XML with details that define their behavior or appearance.
SVG is one of the few formats for images that meets very high standards in these terms: scalability, interactivity, performance, accessibility, programmability, and others. For these reasons, it is commonly used in web development.
You may want to use SVG files when you need to
- print your presentation in a very large format. SVG images can scale up to any resolution or level. You get to resize SVG images as many times as necessary without sacrificing quality.
- use charts and graphs from your slides in different mediums or platforms. Most readers can interpret SVG files.
- use the smallest possible sizes of images. SVG files are generally smaller than their high-resolution equivalents in other formats, especially those formats based on bitmap (JPEG or PNG).
Render a Slide as an SVG Image
Aspose.Slides for .NET allows you to export slides in your presentations as SVG images. Go through these steps to generate SVG images:
Steps: PowerPoint to SVG Conversions in C#
The following sample code explains these conversions using .NET.
- Steps: Convert PowerPoint to SVG in C#
- Steps: Convert PPT to SVG in C#
- Steps: Convert PPTX to SVG in C#
- Steps: Convert ODP to SVG in C#
Code Steps:
- Create an instance of the Presentation class.
- .ppt extension to load PPT file inside Presentation class.
- .pptx extension to load PPTX file inside Presentation class.
- .odp extension to load ODP file inside Presentation class.
- .pps extension to load PPS file inside Presentation class.
- Iterate through all the slides in the presentation.
- Write every slide to its own SVG file through FileStream.
This sample code in C# shows you how to convert PowerPoint to SVG using Aspose.Slides:
// 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
This article also covers these topics. The codes are same as above.
Format: PowerPoint
- C# PowerPoint to SVG Code
- C# PowerPoint to SVG API
- C# PowerPoint to SVG Programmatically
- C# PowerPoint to SVG Library
- C# Save PowerPoint as SVG
- C# Generate SVG from PowerPoint
- C# Create SVG from PowerPoint
- C# PowerPoint to SVG Converter
Format: PPT
- C# PPT to SVG Code
- C# PPT to SVG API
- C# PPT to SVG Programmatically
- C# PPT to SVG Library
- C# Save PPT as SVG
- C# Generate SVG from PPT
- C# Create SVG from PPT
- C# PPT to SVG Converter
Format: PPTX
- C# PPTX to SVG Code
- C# PPTX to SVG API
- C# PPTX to SVG Programmatically
- C# PPTX to SVG Library
- C# Save PPTX as SVG
- C# Generate SVG from PPTX
- C# Create SVG from PPTX
- C# PPTX to SVG Converter
Format: ODP