PowerPoint file is a presentation file developed by Microsoft PowerPoint. In certain cases, you may need to combine two or more PowerPoint presentations. For example, you need to merge slides for creating presentations using your previously created slideshows for data referencing or when different users are working the same topic. Combining PowerPoint slides helps you to keep your information consistent and make your PowerPoint presentations more efficient. Today, we will learn how to merge multiple PowerPoint presentations into one in Node.js.
The following topics shall be covered in this article:
- Document Merger REST API and Node.js SDK
- Merge Multiple PowerPoint Presentations in Node.js using REST API
- How to Merge Specific PowerPoint Slides using Node.js
Document Merger REST API and Node.js SDK
In order to merge multiple PPTX files, I will be using the Node.js SDK of GroupDocs.Merger Cloud API. It allows you to combine, extract, remove and rearrange a single page or a collection of pages from supported document formats such as Word, Excel, PowerPoint, Visio drawings, PDF, and HTML etc.
You can install GroupDocs.Merger cloud to your Node.js application using the following command in the console:
npm install groupdocs-merger-cloud
Please get your Client ID and Secret from the dashboard before following the mentioned steps. Once you have your ID and secret, add in the code as shown below:
Merge Multiple PowerPoint Presentations in Node.js using REST API
You can combine multiple PowerPoint presentations into a single file programmatically on the cloud by following the simple steps given below:
- Upload the PowerPoint files to the cloud
- Combine multiple PowerPoint files using Node.js
- Download the merged PPTX Presentation
Upload the PowerPoint Files
Firstly, upload the PowerPoint files to the cloud using the code example given below:
As a result, the uploaded PowerPoint files will be available in the files section of your dashboard on the cloud.
Merge Multiple PowerPoint Files using Node.js
You can easily merge multiple PPT or PPTX files into a single file programmatically by following the steps mentioned below:
- Create an instance of the DocumentApi
- Now, create the first JoinItem
- Next, create the first item FileInfo
- Provide the input file path for first JoinItem in the FileInfo
- Create the second JoinItem
- Create the second item FileInfo
- Provide the input file path for second JoinItem in the FileInfo
- Create the multiple files JoinOptions
- Add comma separated list of created join items
- Set the output file path
- Create JoinRequest with JoinOptions as argument
- Get results by calling the join() method of the DocumentAPI
The following code snippet shows how to merge multiple PowerPoint presentations using REST API in Node.js:
Download the Merged File
The above code sample will save the merged PowerPoint PPTX file on the cloud. You can download it using the following code sample:
How to Merge Specific PowerPoint Slides using Node.js
You can easily merge specific slides of multiple PPTX files into a single file programmatically by following the steps mentioned below:
- Firstly, create an instance of the DocumentApi
- Next, create the first JoinItem
- Now, create the first item FileInfo
- Set the input file path for first JoinItem in the FileInfo
- Provide comma separated list of pages to combine
- Create the second JoinItem
- Create the second item FileInfo
- Set the input file path for second JoinItem in the FileInfo
- Now, set startPageNumber value
- next, set endPageNumber value
- Create the multiple files JoinOptions
- Add comma separated list of created join items
- Set the output file path
- Create JoinRequest with JoinOptions as argument
- Get results by calling the join() method of the DocumentAPI
The following code snippet shows how to merge specific PowerPoint pptx slides using REST API in Node.js:
Try Online
Please try the following free online PPTX merger tool, which is developed using the above API.
Conclusion
In this article, you have learned:
- how to merge multiple PowerPoint files on the cloud;
- programmatically upload PowerPoint files on the cloud;
- how to merge specific pptx slides into one file using REST API in Node.js;
- programmatically download the merged file from the cloud;
The API also enables you to reorder or replace document pages, change page orientation, manage document passwords and perform other manipulations easily for any supported file format. It also provides .NET, Java, PHP, Ruby, Android, and Python SDKs as its document merger family members for the Cloud API. You can learn more about GroupDocs.Merge Cloud API using the documentation. We also provide an API Reference section that lets you visualize and interact with our APIs directly through the browser.
Ask a question
You can ask your queries about how to combine PPTX slides, via our Free Support Forum