How to convert a Keynote file into a PDF in C# .Net Framework

File conversion is pretty tedious to deal with at the best of times. When you add in all of the added complications from migrating Mac specific formats to PC, it becomes a nightmare. Not to worry, though, we have a nice simple solution for you — one that will save you hours of time. By employing an API, we will be getting the highest fidelity with the least time investment.

To start things off, we will be using the NuGet console to install our package:

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

Now we call our Keynote to PDF conversion function, as you see here:

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 ConvertDocumentKeynoteToPdfExample{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 Keynote Presentation (KEY) to PDFbyte[] result = apiInstance.ConvertDocumentKeynoteToPdf(inputFile);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentKeynoteToPdf: " + e.Message );}}}}

And that is really all there is to that! Super simple.

Image for post
Image for post

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