How to convert PowerPoint PPTX to PDF using C# in .NET Framework

Cloudmersive
2 min readSep 10, 2019

--

Sometimes a PDF is just more convenient than a clunky PowerPoint file. Converting between the two has never been easier. Today we will accomplishing this in just a couple of easy steps. First let’s install our Convert Client using NuGet:

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

Then we just have to call ConvertDocumentPptxToPdf:

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 ConvertDocumentPptxToPdfExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.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
{
// PowerPoint PPTX to PDF
byte[] result = apiInstance.ConvertDocumentPptxToPdf(inputFile);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentPptxToPdf: " + e.Message );
}
}
}
}

And it’s as simple as that! This function is the most efficient for PPTX to PDF, but if you need more flexibility, you may also use ConvertDocumentAutodetectToPdf, which supports a variety of document and image formats. Check out our documentation section for a full list of functions, including image format conversion, document editing, and PDF merging.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet