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.

Image for post
Image for post

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store