How to convert PDF to PowerPoint PPTX Presentation in Node.JS

A common need is to quickly convert a large number of PDFs into PowerPoint presentations. This is generally an arduous task when approached in the normal manner, which is why we will be tackling it in a more unorthodox way. We will be bypassing all of the coding by using a simple API call instead.

To begin with, we need to install our API client. Easy enough with npm install.

npm install cloudmersive-convert-api-client --save

Now that that’s finished, our API functions are available to be called. We will use convertDocumentPdfToPptx.

var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveConvertApiClient.ConvertDocumentApi();var inputFile = "/path/to/file"; // File | Input file to perform the operation on.var callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.convertDocumentPdfToPptx(inputFile, callback);

And that about does it. Our new PowerPoint file will have one PDF page per slide.

Image for post
Image for post

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