Compare PowerPoint Presentations in Node.js

Compare PPTX Files in Node.js

We can compare two or more PowerPoint presentation files and highlight the differences programmatically on the cloud. It helps to identify the changes in different versions of the presentation programmatically. In this article, we will learn how to compare two or more PowerPoint presentations using a REST API in Node.js.

The following topics shall be covered in this compare powerpoint files article:

REST API and Node.js SDK to Compare PPTX Files

For comparing two or more PPTX files, we will be using the Node.js SDK of GroupDocs.Comparison Cloud API. It allows to compare 2 powerpoint files ‎of the supported formats and finding the differences in a resultant file. Please install it using the following command in the console:

npm install groupdocs-comparison-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:

Next, let’s learn how to compare ppt files and compare two ppt files for differences.

Compare Two PowerPoint Presentations using a REST API in Node.js

We can compare two PowerPoint files on the cloud by following the simple steps given below:

  1. Upload the PPTX files to the cloud.
  2. Compare Uploaded PPTX Files.
  3. Download the resultant file.

Upload the PowerPoint Files

Firstly, we will upload the source and target PPTX files to the cloud using the following code sample:

As a result, the uploaded PowerPoint files will be available in the files section of the dashboard to compare powerpoint documents on the cloud.

Compare PowerPoint Files in Node.js

Now, we will compare ppt the uploaded PowerPoint files programmatically by following the steps given below:

  • Firstly, create an instance of the CompareApi.
  • Next, set the input source and target PPTX file paths.
  • Then, initialize the ComparisonOptions object and assign source and target files.
  • Next, set the output file path.
  • After that, create the ComparisonsRequest with ComparisonOptions as an argument.
  • Finally, compare powerpoint slides and get results using the comparisons() method.

The following code sample shows how to compare two PowerPoint files using a REST API in Node.js.

Source and Target PowerPoint Presentations Files | Powerpoint template for comparison

Source and Target PowerPoint Presentations Files.

Compare PowerPoint Files in Node.js | Comparison in powerpoint

Compare PowerPoint Files in Node.js

The resultant PPTX file also contains a summary slide at the end of the document, as shown below:

Compare presentation powerpoint  and comparison summary of changes.

Download the Resultant File

As a result, the above code sample will save a newly created PowerPoint file with changes on the cloud. It can be downloaded using the following code sample:

Compare Multiple PowerPoint Files using Node.js

We can also compare multiple PowerPoint documents by following the steps given below:

  • Firstly, create an instance of the CompareApi.
  • Next, set the input source PPTX file path.
  • Then, set multiple target PPTX file paths.
  • Next, initialize the ComparisonOptions object and assign source and target files.
  • Then, set the output file path.
  • After that, create the ComparisonsRequest with ComparisonOptions as an argument.
  • Finally, compare files and get results using the comparisons() method.

The following code sample shows how to compare multiple PowerPoint files using a REST API in Node.js.

Get List of Changes using REST API in Node.js

We can get a list of all the changes found during the comparison of PowerPoint files by following the steps given below:

  • Firstly, create an instance of the CompareApi.
  • Next, set the input source PPTX file path.
  • Then, set the target PPTX file path.
  • Next, Initialize the ComparisonOptions object.
  • Then, assign source/target files and set the output file path.
  • After that, create the PostChangesRequest with ComparisonOptions object as an argument.
  • Finally, get results by calling the postChanges() method.

The following code sample shows how to get a list of changes using a REST API in Node.js.

Changes count: 4
1- Target Text: Document Comparison, Text: Shape, Type: Inserted
2- Target Text: undefined, Text: Shape, Type: Deleted
3- Target Text: Document Comparison REST API & Node.js SDK, Text: Node.js , Type: Deleted
4- Target Text: Document Comparison REST API & Node.js SDK, Text: Node.js , Type: Inserted

Try Online

How to compare two ppt files online free? Please try the following free online PPTX comparison tool for powerpoint presentation comparison. This comparison powerpoint template free software to compare ppt online is developed using the above API. https://products.groupdocs.app/comparison/pptx

Conclusion

In this article, we have learned how to:

  • compare two or more PowerPoint files in Node.js;
  • get a list of inserted and deleted items;
  • programmatically upload more than one PPTX files to the cloud;
  • download the PPTX file from the cloud.

Besides, you can learn more about GroupDocs.Comparison 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. In case of any ambiguity, please feel free to contact us on the forum.

See Also