How to convert ODP to PDF in Node.JS

Open document presentation format, or ODP, is great if you have the right software to use it. Unfortunately, this isn’t always the case, nor is it the most compatible with web viewing. So what can we do about this? Converting to PDF is a great choice, as this will solve the problem immediately, while preserving the overall style of the presentation. Let’s look at how we can do this as quickly as we possibly can.

Firstly, we are going to install our client, which means adding this reference to package.json.

"dependencies": {
"cloudmersive-convert-api-client": "^2.4.8"

Let that finish installing, then it’s time to create our function call. This is a snap if you follow this code example as your model.

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.ConvertDocumentApi();var inputFile = "/path/to/file"; // 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.convertDocumentOdpToPdf(inputFile, callback);

Done! Super easy.

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