How to merge two PowerPoint PPTX files together in Node.JS

Merging PowerPoint presentations has never been easier, and I am about to demonstrate why that is. With judicious application of a Cloudmersive API, we will complete this task in record time.

The following reference should be added to package.json, which will allow installation of our API client package.

"dependencies": {
"cloudmersive-convert-api-client": "^2.1.6"
}

From there we should first instance our API, then call mergeDocumentPptx through that instance. To do this, we will need two (or more) input file PPTXs. The order of these is important, as it will determine the order in which their content appears in the merged file.

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.MergeDocumentApi();var inputFile1 = "/path/to/file"; // File | First input file to perform the operation on.var inputFile2 = "/path/to/file"; // File | Second input file to perform the operation on (more than 2 can be supplied).var callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.mergeDocumentPptx(inputFile1, inputFile2, callback);

Submit your request and a short time later you will have your merged PPTX file. Following that, you can proceed to call again with the result as inputFile1, allowing you to chain together as many files as you wish.

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