How to convert a PowerPoint PPTX to a PNG Array in C# .NET Framework

Sometimes PPTX format can be quite inconvenient, leading to all sorts of problems with compatibility. To solve this problem once and for all, we will be exploring a solution today that will allow us to convert PPTX files into arrays of PNG images. This will take just a handful of minutes, mostly just waiting for our package to install and testing it.

So let’s grab that package first:

Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.2.8

And next we will call our function for converting between the formats:

using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;namespace Example{public class ConvertDocumentPptxToPngExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new ConvertDocumentApi();var inputFile = new System.IO.Stream(); // System.IO.Stream | Input file to perform the operation on.try{// Convert PowerPoint PPTX to PNG image arrayPptxToPngResult result = apiInstance.ConvertDocumentPptxToPng(inputFile);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentPptxToPng: " + e.Message );}}}}

And that’s really all there is to it!

Written by

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store