How to Convert ODP to PPTX using Node.js
Open Document Presentation files and PowerPoint files are a bit like cousins in the digital presentation space. The latter is clearly more commonly used, however, which makes ODP to PPTX a useful conversion to have at our disposal.
Thankfully, we can easily implement a free ODP to PPTX conversion API into our Node.js applications using the minimal & ready-to-run code examples provided below. This will quickly and securely convert our ODP content in-memory, returning PPTX contents in our response — simple as that.
To structure our API call, we can start by installing the SDK. This requires us either running the below command:
npm install cloudmersive-convert-api-client --save
Or adding the following snippet to our package.json:
"dependencies": {
"cloudmersive-convert-api-client": "^2.6.3"
}
Now we can include our function to make our request. We’ll need to authorize our request, too, and we can do so for free by including a free-tier API key (these allow up to 800 API calls per month with no additional commitments):
var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');
var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveConvertApiClient.ConvertDocumentApi();
var inputFile = Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer); // 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.convertDocumentOdpToPptx(inputFile, callback);
Now we can freely make ODP to PPTX conversions whenever the need arises. Easy!