How to Convert Keynote Presentations to PDF in C/C++

Cloudmersive
1 min readSep 15, 2023

--

Working outside of the MS Office suite? Not to worry — you can still convert your Keynote Presentations to PDF at scale with a free API solution.

Using the below code, you can take advantage of a free API designed specifically to create raster PDFs from Keynote file input. It’s simple & easy to use, and all you’ll need is a free-tier API key to authorize your requests.

First install libcurl in your project:

libcurl/7.75.0

And then copy the ready-to-run code examples below into your file:

CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.cloudmersive.com/convert/key/to/pdf");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: multipart/form-data");
headers = curl_slist_append(headers, "Apikey: YOUR-API-KEY-HERE");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_mime *mime;
curl_mimepart *part;
mime = curl_mime_init(curl);
part = curl_mime_addpart(mime);
curl_mime_name(part, "inputFile");
curl_mime_filedata(part, "/path/to/file");
curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
res = curl_easy_perform(curl);
curl_mime_free(mime);
}
curl_easy_cleanup(curl);

Now you can easily convert Keynote to PDF at scale with zero hassle (and minimal code).

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet