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

Cloudmersive
2 min readMay 12, 2020

--

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.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet