Home > Articles > .Net Framework Articles > Export PowerPoint slides to Images with a free .NET library in C#.

Export PowerPoint slides to Images with a free .NET library in C#.

by sarker ishwar   on Dec 02, 2014   Category: .Net Framework  | Level: Beginner  |  Views: 5626    |  Points: 100   
Like this article? Bookmark and Share:
You may found that when we print the PowerPoint documents directly, it is not clear enough. So we need to convert the PowerPoint Presentation file into images with high resolution firstly. In this article we are going to see how to convert PowerPoint slides to image in a pretty easy method by using Spire.Presentation.

What is Spire.Presentation?

Spire.Presentation is a .NET PowerPoint library which enables developers to operate PowerPoint documents from C# and VB.NET. It doesn't require Microsoft PowerPoint to be installed on the system.You can download to get the Spire.Presentation.dll from here:

http://www.nuget.org/packages/Spire.Presentation/

Here comes to the sample code of save presentation slides as image. In the demo of it, each slide will be converted to the single image.

Tools we need:

- Spire.Presentation.dll
- Visual Studio

Namespaces to be used

using Spire.Presentation;

using System.Drawing;

Please check the visual C# code for converting PowerPoint document to Png as below:


Presentation presentation = new Presentation();

presentation.LoadFromFile("sample.pptx");

//traverse the slides of PPT files

for (int i = 0; i < presentation.Slides.Count; i++)

{

    //save the slide to Image

    Image image = presentation.Slides[i].SaveAsImage();

 

    String fileName = String.Format("result-img-{0}.Png", i);

    image.Save(fileName, System.Drawing.Imaging.ImageFormat.Png);

    //view the image

    System.Diagnostics.Process.Start(fileName);

}

 

Spire.Presentation supports multiple image formats, such as Bmp, Emf, Gif, Jpeg, Tiff, Png, etc. Check the image file formats listed as below:

Effective screenshot for the resulted image in PNG format:



There are many other main elements that Spire.Presentation supports:

l  All kinds of shapes in PowerPoint document (such as triangle, rectangle, BackOrPreviousButton );

l  Audio, video, Animation in PowerPoint document;

l  Table, chart, hyperlinks;

l  Export the slides to other file format, such as PDF and XPS;

Conclusion:

Generally speaking, I was impressed by the power and ease provided by this product. You are welcome to test the demo code. And I hope this article can do you some help.




Like this article? Bookmark and Share:

Most viewed Articles

User Comments


No response found, be the first to review this article.

Submit feedback about this article

Please sign in to post feedback

Latest Posts