How to Convert ODT to PNG in Node.JS

Cloudmersive
1 min readJun 29, 2020

--

It’s probably safe to assume that you don’t want to have to dive into the mess that is file format conversion in Node.JS. Allow me to take this possibility out of the picture for you. I will show you how to use an API to get this functionality into your app in no time flat.

Let’s install our client as our first order of business, using npm install.

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

Now we just need to call our function as you can see below.

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

And, well, that’s really about it. Super easy.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet