How to convert ODS to PDF in Node.JS

Open document spreadsheets (ODS) certainly have their own set of advantages, but there are some downsides as well. Compatibility is perhaps highest on that list, with many programs unable to handle them. PDF, on the other hand, pretty much has its own skeleton key, with near universal acceptance, so let’s make the change over to that. Instead of the highly complex normal process for this conversion, we are opting for a Cloudmersive API instead, which will shave hours off the total.

To begin, we must install the client for said API.

npm install cloudmersive-convert-api-client --save

Next up is our function call, which you can model after this example.

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.convertDocumentOdsToPdf(inputFile, callback);

And there you go! The API will handle your conversion on its end and send back your finished PDF, with no further effort needed on your part.

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