Articles in this section
Category / Section

How to export a PowerPoint presentation file as images in C#, VB.NET

1 min read

Syncfusion Essential Presentation is a .NET PowerPoint library used to create, open, read, edit, and export PowerPoint presentations. Using this library, you can export a PowerPoint presentation slides as images in C# and VB.NET.

Steps to export a PowerPoint file as images programmatically:

  1. Create a new C# console application.

 

  1. Install Syncfusion.Presentation.Base NuGet package to the console application project from nuget.org. For more information about adding a NuGet feed in Visual Studio and installing NuGet packages, refer to documentation.

 

  1. Install Syncfusion.OfficeChartToImageConverter.Wpf NuGet package to the console application project from nuget.org.

 

  1. Include the following namespace in the Program.cs file.
using Syncfusion.Presentation;
using Syncfusion.OfficeChartToImageConverter;

 

Imports Syncfusion.Presentation
Imports Syncfusion.OfficeChartToImageConverter

 

  1. Use the following code snippet to convert the slides in the PowerPoint presentation as images.
//Open the PowerPoint Presentation.
IPresentation powerpointDoc = Presentation.Open("Sample.pptx");
 
//Create an instance of ChartToImageConverter and assign it to ChartToImageConverter property of Presentation.
powerpointDoc.ChartToImageConverter = new ChartToImageConverter();
 
//Iterate the slides in the PowerPoint file and convert to image
foreach (ISlide slide in powerpointDoc.Slides)
{
    //Convert the slide as jpeg image.
    System.IO.Stream imageStream = slide.ConvertToImage(Syncfusion.Drawing.ImageFormat.Jpeg);
 
    //Save the stream to an image instance
    System.Drawing.Image convertedImage = System.Drawing.Image.FromStream(imageStream);
 
    //Save the image to a file.
    convertedImage.Save("Slide_" + slide.SlideNumber + ".jpg");
}
 
//Close the presentation.
powerpointDoc.Close();

 

'Open the PowerPoint Presentation.
Dim powerpointDoc As IPresentation = Presentation.Open("Sample.pptx")
 
'Create an instance of ChartToImageConverter and assign it to ChartToImageConverter property of presentation.
powerpointDoc.ChartToImageConverter = New ChartToImageConverter()
 
'Iterate the slides in the PowerPoint file and convert to image
For Each slide As ISlide In powerpointDoc.Slides
    'Convert the slide as bitmap image.
    Dim imageStream As IO.Stream = slide.ConvertToImage(Syncfusion.Drawing.ImageFormat.Jpeg)
 
    'Save the stream to an image instance
    Dim convertedImage As Image = Image.FromStream(imageStream)
 
    'Save the image to a file
    convertedImage.Save("Slide_" + slide.SlideNumber.ToString() + ".jpg")
Next
 
'Close the presentation.
powerpointDoc.Close()

 

You can download the working sample from Convert-PowerPoint-To-Images.Zip.

An online sample link to convert a PowerPoint presentation slides as images.

Take a moment to peruse the documentation, where you can find mode details with code examples. Refer here to explore the rich set of Syncfusion Essential Presentation features.

Note:

Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied