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

Cloudmersive
1 min readMar 21, 2020

--

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.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet