How to Convert a PDF to a PowerPoint PPTX Presentation with JavaScript

Cloudmersive
2 min readAug 19, 2022

--

Given the difficulties associated with sharing bulky PPTX files across networks, it’s common practice to first convert those files to PDFs for better compression & excellent quality/formatting retention. On the other end of that process, however, the inverse conversion is required to make that file reviewable/editable in PowerPoint once again — and thankfully, there’s an API for that. You can easily perform that conversion at scale with our PDF to PPTX conversion API, which returns a high-fidelity output that can be edited and processed in PowerPoint without any issues.

You can take advantage of this API for free using the JavaScript code examples provided below to structure your API call. You’ll also need an API key to authenticate access, which you can get by registering a free account on our website (you’ll get a limit of 800 API calls with this account).

We can structure our API call two different ways — starting by using the XHR request capability built into JavaScript:

var data = new FormData();
data.append("inputFile", fileInput.files[0], "file");

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.cloudmersive.com/convert/pdf/to/pptx");xhr.setRequestHeader("Apikey", "YOUR-API-KEY-HERE");xhr.send(data);

Alternatively, we can install the jQuery library by running the below command:

bower install jquery

And then structure the API call using the following examples:

var form = new FormData();
form.append("inputFile", fileInput.files[0], "file");
var settings = {
"url": "https://api.cloudmersive.com/convert/pdf/to/pptx",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "multipart/form-data",
"Apikey": "YOUR-API-KEY-HERE"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});

It’s just as simple as that — no more code required.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet