.NET PowerPoint Examples
Convert PowerPoint to Image with Syncfusion .NET PowerPoint Library
The Syncfusion® .NET PowerPoint Library offers powerful and comprehensive APIs to convert a PowerPoint presentation into images programmatically with just a few lines of code and without Microsoft PowerPoint or interop dependencies. It allows you to convert an entire presentation into images or a single slide into an image, which can then be used to provide a document preview or thumbnail or be used for printing purposes.
Watch this video to learn how to convert PowerPoint presentations into image using the Syncfusion® .NET PowerPoint library.
Convert PowerPoint to image using C#
Learn how to convert PowerPoint presentations to images programmatically using C# with the Syncfusion .NET PowerPoint library. This guide demonstrates converting entire presentations or individual slides into image formats.
Step 1: Create a new project
Start by creating a new C# Console Application project.
Step 2: Install the NuGet package
Add the Syncfusion.PresentationRenderer.Net.Core package to your project from NuGet.org.
Step 3: Add required namespaces to convert PowerPoint to image
Add the following namespaces to your Program.cs file:
using Syncfusion.Presentation;
using Syncfusion.PresentationRenderer;Step 4: Open an existing PowerPoint presentation
Open a PowerPoint file from a file stream.
FileStream inputStream = new(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
//Load the presentation
IPresentation pptxDoc = Presentation.Open(inputStream)Step 5: Convert slide to image
Convert the first slide of the PowerPoint presentation to an image stream.
//Initialize PresentationRenderer
pptxDoc.PresentationRenderer = new PresentationRenderer();
//Convert the PowerPoint slide as an image stream
Stream stream = pptxDoc.Slides[0].ConvertToImage(ExportImageFormat.Jpeg)Step 6: Save the image
Save the converted image stream to a file.
//Save the image stream to a file
FileStream fileStreamOutput = File.Create(Path.GetFullPath(@"Output/Image.jpg"));
stream.CopyTo(fileStreamOutput);
//Close streams and presentation
fileStreamOutput.Close();
stream.Close();
pptxDoc.Close();
inputStream.Close();GitHub project
NuGet installation
Get started quickly by downloading the installer and checking license information on the Downloads page.
Table of contents
Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.
Learning
Technical Support
